+
/** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 2.1.8 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details
*/
+//Not using strict: uneven strict support in browsers, #392, and causes
+//problems with requirejs.exec()/transpiler plugins that may not be strict.
+/*jslint regexp: true, nomen: true, sloppy: true */
+/*global window, navigator, document, importScripts, setTimeout, opera */
+
+var requirejs, require, define;
+(function (global) {
+ var req, s, head, baseElement, dataMain, src,
+ interactiveScript, currentlyAddingScript, mainScript, subPath,
+ version = '2.1.8',
+ commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
+ cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,
+ jsSuffixRegExp = /\.js$/,
+ currDirRegExp = /^\.\//,
+ op = Object.prototype,
+ ostring = op.toString,
+ hasOwn = op.hasOwnProperty,
+ ap = Array.prototype,
+ apsp = ap.splice,
+ isBrowser = !!(typeof window !== 'undefined' && navigator && window.document),
+ isWebWorker = !isBrowser && typeof importScripts !== 'undefined',
+ //PS3 indicates loaded and complete, but need to wait for complete
+ //specifically. Sequence is 'loading', 'loaded', execution,
+ // then 'complete'. The UA check is unfortunate, but not sure how
+ //to feature test w/o causing perf issues.
+ readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
+ /^complete$/ : /^(complete|loaded)$/,
+ defContextName = '_',
+ //Oh the tragedy, detecting opera. See the usage of isOpera for reason.
+ isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]',
+ contexts = {},
+ cfg = {},
+ globalDefQueue = [],
+ useInteractive = false;
+
+ function isFunction(it) {
+ return ostring.call(it) === '[object Function]';
+ }
+
+ function isArray(it) {
+ return ostring.call(it) === '[object Array]';
+ }
+
+ /**
+ * Helper function for iterating over an array. If the func returns
+ * a true value, it will break out of the loop.
+ */
+ function each(ary, func) {
+ if (ary) {
+ var i;
+ for (i = 0; i < ary.length; i += 1) {
+ if (ary[i] && func(ary[i], i, ary)) {
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Helper function for iterating over an array backwards. If the func
+ * returns a true value, it will break out of the loop.
+ */
+ function eachReverse(ary, func) {
+ if (ary) {
+ var i;
+ for (i = ary.length - 1; i > -1; i -= 1) {
+ if (ary[i] && func(ary[i], i, ary)) {
+ break;
+ }
+ }
+ }
+ }
+
+ function hasProp(obj, prop) {
+ return hasOwn.call(obj, prop);
+ }
+
+ function getOwn(obj, prop) {
+ return hasProp(obj, prop) && obj[prop];
+ }
+
+ /**
+ * Cycles over properties in an object and calls a function for each
+ * property value. If the function returns a truthy value, then the
+ * iteration is stopped.
+ */
+ function eachProp(obj, func) {
+ var prop;
+ for (prop in obj) {
+ if (hasProp(obj, prop)) {
+ if (func(obj[prop], prop)) {
+ break;
+ }
+ }
+ }
+ }
+
+ /**
+ * Simple function to mix in properties from source into target,
+ * but only if target does not already have a property of the same name.
+ */
+ function mixin(target, source, force, deepStringMixin) {
+ if (source) {
+ eachProp(source, function (value, prop) {
+ if (force || !hasProp(target, prop)) {
+ if (deepStringMixin && typeof value !== 'string') {
+ if (!target[prop]) {
+ target[prop] = {};
+ }
+ mixin(target[prop], value, force, deepStringMixin);
+ } else {
+ target[prop] = value;
+ }
+ }
+ });
+ }
+ return target;
+ }
+
+ //Similar to Function.prototype.bind, but the 'this' object is specified
+ //first, since it is easier to read/figure out what 'this' will be.
+ function bind(obj, fn) {
+ return function () {
+ return fn.apply(obj, arguments);
+ };
+ }
+
+ function scripts() {
+ return document.getElementsByTagName('script');
+ }
+
+ function defaultOnError(err) {
+ throw err;
+ }
+
+ //Allow getting a global that expressed in
+ //dot notation, like 'a.b.c'.
+ function getGlobal(value) {
+ if (!value) {
+ return value;
+ }
+ var g = global;
+ each(value.split('.'), function (part) {
+ g = g[part];
+ });
+ return g;
+ }
+
+ /**
+ * Constructs an error with a pointer to an URL with more information.
+ * @param {String} id the error ID that maps to an ID on a web page.
+ * @param {String} message human readable error.
+ * @param {Error} [err] the original error, if there is one.
+ *
+ * @returns {Error}
+ */
+ function makeError(id, msg, err, requireModules) {
+ var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
+ e.requireType = id;
+ e.requireModules = requireModules;
+ if (err) {
+ e.originalError = err;
+ }
+ return e;
+ }
+
+ if (typeof define !== 'undefined') {
+ //If a define is already in play via another AMD loader,
+ //do not overwrite.
+ return;
+ }
+
+ if (typeof requirejs !== 'undefined') {
+ if (isFunction(requirejs)) {
+ //Do not overwrite and existing requirejs instance.
+ return;
+ }
+ cfg = requirejs;
+ requirejs = undefined;
+ }
+
+ //Allow for a require config object
+ if (typeof require !== 'undefined' && !isFunction(require)) {
+ //assume it is a config object.
+ cfg = require;
+ require = undefined;
+ }
+
+ function newContext(contextName) {
+ var inCheckLoaded, Module, context, handlers,
+ checkLoadedTimeoutId,
+ config = {
+ //Defaults. Do not set a default for map
+ //config to speed up normalize(), which
+ //will run faster if there is no default.
+ waitSeconds: 7,
+ baseUrl: './',
+ paths: {},
+ pkgs: {},
+ shim: {},
+ config: {}
+ },
+ registry = {},
+ //registry of just enabled modules, to speed
+ //cycle breaking code when lots of modules
+ //are registered, but not activated.
+ enabledRegistry = {},
+ undefEvents = {},
+ defQueue = [],
+ defined = {},
+ urlFetched = {},
+ requireCounter = 1,
+ unnormalizedCounter = 1;
+
+ /**
+ * Trims the . and .. from an array of path segments.
+ * It will keep a leading path segment if a .. will become
+ * the first path segment, to help with module name lookups,
+ * which act like paths, but can be remapped. But the end result,
+ * all paths that use this function should look normalized.
+ * NOTE: this method MODIFIES the input array.
+ * @param {Array} ary the array of path segments.
+ */
+ function trimDots(ary) {
+ var i, part;
+ for (i = 0; ary[i]; i += 1) {
+ part = ary[i];
+ if (part === '.') {
+ ary.splice(i, 1);
+ i -= 1;
+ } else if (part === '..') {
+ if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
+ //End of the line. Keep at least one non-dot
+ //path segment at the front so it can be mapped
+ //correctly to disk. Otherwise, there is likely
+ //no path mapping for a path starting with '..'.
+ //This can still fail, but catches the most reasonable
+ //uses of ..
+ break;
+ } else if (i > 0) {
+ ary.splice(i - 1, 2);
+ i -= 2;
+ }
+ }
+ }
+ }
+
+ /**
+ * Given a relative module name, like ./something, normalize it to
+ * a real name that can be mapped to a path.
+ * @param {String} name the relative name
+ * @param {String} baseName a real name that the name arg is relative
+ * to.
+ * @param {Boolean} applyMap apply the map config to the value. Should
+ * only be done if this normalization is for a dependency ID.
+ * @returns {String} normalized name
+ */
+ function normalize(name, baseName, applyMap) {
+ var pkgName, pkgConfig, mapValue, nameParts, i, j, nameSegment,
+ foundMap, foundI, foundStarMap, starI,
+ baseParts = baseName && baseName.split('/'),
+ normalizedBaseParts = baseParts,
+ map = config.map,
+ starMap = map && map['*'];
+
+ //Adjust any relative paths.
+ if (name && name.charAt(0) === '.') {
+ //If have a base name, try to normalize against it,
+ //otherwise, assume it is a top-level require that will
+ //be relative to baseUrl in the end.
+ if (baseName) {
+ if (getOwn(config.pkgs, baseName)) {
+ //If the baseName is a package name, then just treat it as one
+ //name to concat the name with.
+ normalizedBaseParts = baseParts = [baseName];
+ } else {
+ //Convert baseName to array, and lop off the last part,
+ //so that . matches that 'directory' and not name of the baseName's
+ //module. For instance, baseName of 'one/two/three', maps to
+ //'one/two/three.js', but we want the directory, 'one/two' for
+ //this normalization.
+ normalizedBaseParts = baseParts.slice(0, baseParts.length - 1);
+ }
+
+ name = normalizedBaseParts.concat(name.split('/'));
+ trimDots(name);
+
+ //Some use of packages may use a . path to reference the
+ //'main' module name, so normalize for that.
+ pkgConfig = getOwn(config.pkgs, (pkgName = name[0]));
+ name = name.join('/');
+ if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
+ name = pkgName;
+ }
+ } else if (name.indexOf('./') === 0) {
+ // No baseName, so this is ID is resolved relative
+ // to baseUrl, pull off the leading dot.
+ name = name.substring(2);
+ }
+ }
+
+ //Apply map config if available.
+ if (applyMap && map && (baseParts || starMap)) {
+ nameParts = name.split('/');
+
+ for (i = nameParts.length; i > 0; i -= 1) {
+ nameSegment = nameParts.slice(0, i).join('/');
+
+ if (baseParts) {
+ //Find the longest baseName segment match in the config.
+ //So, do joins on the biggest to smallest lengths of baseParts.
+ for (j = baseParts.length; j > 0; j -= 1) {
+ mapValue = getOwn(map, baseParts.slice(0, j).join('/'));
+
+ //baseName segment has config, find if it has one for
+ //this name.
+ if (mapValue) {
+ mapValue = getOwn(mapValue, nameSegment);
+ if (mapValue) {
+ //Match, update name to the new value.
+ foundMap = mapValue;
+ foundI = i;
+ break;
+ }
+ }
+ }
+ }
+
+ if (foundMap) {
+ break;
+ }
+
+ //Check for a star map match, but just hold on to it,
+ //if there is a shorter segment match later in a matching
+ //config, then favor over this star map.
+ if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) {
+ foundStarMap = getOwn(starMap, nameSegment);
+ starI = i;
+ }
+ }
+
+ if (!foundMap && foundStarMap) {
+ foundMap = foundStarMap;
+ foundI = starI;
+ }
+
+ if (foundMap) {
+ nameParts.splice(0, foundI, foundMap);
+ name = nameParts.join('/');
+ }
+ }
+
+ return name;
+ }
+
+ function removeScript(name) {
+ if (isBrowser) {
+ each(scripts(), function (scriptNode) {
+ if (scriptNode.getAttribute('data-requiremodule') === name &&
+ scriptNode.getAttribute('data-requirecontext') === context.contextName) {
+ scriptNode.parentNode.removeChild(scriptNode);
+ return true;
+ }
+ });
+ }
+ }
+
+ function hasPathFallback(id) {
+ var pathConfig = getOwn(config.paths, id);
+ if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) {
+ removeScript(id);
+ //Pop off the first array value, since it failed, and
+ //retry
+ pathConfig.shift();
+ context.require.undef(id);
+ context.require([id]);
+ return true;
+ }
+ }
+
+ //Turns a plugin!resource to [plugin, resource]
+ //with the plugin being undefined if the name
+ //did not have a plugin prefix.
+ function splitPrefix(name) {
+ var prefix,
+ index = name ? name.indexOf('!') : -1;
+ if (index > -1) {
+ prefix = name.substring(0, index);
+ name = name.substring(index + 1, name.length);
+ }
+ return [prefix, name];
+ }
+
+ /**
+ * Creates a module mapping that includes plugin prefix, module
+ * name, and path. If parentModuleMap is provided it will
+ * also normalize the name via require.normalize()
+ *
+ * @param {String} name the module name
+ * @param {String} [parentModuleMap] parent module map
+ * for the module name, used to resolve relative names.
+ * @param {Boolean} isNormalized: is the ID already normalized.
+ * This is true if this call is done for a define() module ID.
+ * @param {Boolean} applyMap: apply the map config to the ID.
+ * Should only be true if this map is for a dependency.
+ *
+ * @returns {Object}
+ */
+ function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) {
+ var url, pluginModule, suffix, nameParts,
+ prefix = null,
+ parentName = parentModuleMap ? parentModuleMap.name : null,
+ originalName = name,
+ isDefine = true,
+ normalizedName = '';
+
+ //If no name, then it means it is a require call, generate an
+ //internal name.
+ if (!name) {
+ isDefine = false;
+ name = '_@r' + (requireCounter += 1);
+ }
+
+ nameParts = splitPrefix(name);
+ prefix = nameParts[0];
+ name = nameParts[1];
+
+ if (prefix) {
+ prefix = normalize(prefix, parentName, applyMap);
+ pluginModule = getOwn(defined, prefix);
+ }
+
+ //Account for relative paths if there is a base name.
+ if (name) {
+ if (prefix) {
+ if (pluginModule && pluginModule.normalize) {
+ //Plugin is loaded, use its normalize method.
+ normalizedName = pluginModule.normalize(name, function (name) {
+ return normalize(name, parentName, applyMap);
+ });
+ } else {
+ normalizedName = normalize(name, parentName, applyMap);
+ }
+ } else {
+ //A regular module.
+ normalizedName = normalize(name, parentName, applyMap);
+
+ //Normalized name may be a plugin ID due to map config
+ //application in normalize. The map config values must
+ //already be normalized, so do not need to redo that part.
+ nameParts = splitPrefix(normalizedName);
+ prefix = nameParts[0];
+ normalizedName = nameParts[1];
+ isNormalized = true;
+
+ url = context.nameToUrl(normalizedName);
+ }
+ }
+
+ //If the id is a plugin id that cannot be determined if it needs
+ //normalization, stamp it with a unique ID so two matching relative
+ //ids that may conflict can be separate.
+ suffix = prefix && !pluginModule && !isNormalized ?
+ '_unnormalized' + (unnormalizedCounter += 1) :
+ '';
+
+ return {
+ prefix: prefix,
+ name: normalizedName,
+ parentMap: parentModuleMap,
+ unnormalized: !!suffix,
+ url: url,
+ originalName: originalName,
+ isDefine: isDefine,
+ id: (prefix ?
+ prefix + '!' + normalizedName :
+ normalizedName) + suffix
+ };
+ }
+
+ function getModule(depMap) {
+ var id = depMap.id,
+ mod = getOwn(registry, id);
+
+ if (!mod) {
+ mod = registry[id] = new context.Module(depMap);
+ }
+
+ return mod;
+ }
+
+ function on(depMap, name, fn) {
+ var id = depMap.id,
+ mod = getOwn(registry, id);
+
+ if (hasProp(defined, id) &&
+ (!mod || mod.defineEmitComplete)) {
+ if (name === 'defined') {
+ fn(defined[id]);
+ }
+ } else {
+ mod = getModule(depMap);
+ if (mod.error && name === 'error') {
+ fn(mod.error);
+ } else {
+ mod.on(name, fn);
+ }
+ }
+ }
+
+ function onError(err, errback) {
+ var ids = err.requireModules,
+ notified = false;
+
+ if (errback) {
+ errback(err);
+ } else {
+ each(ids, function (id) {
+ var mod = getOwn(registry, id);
+ if (mod) {
+ //Set error on module, so it skips timeout checks.
+ mod.error = err;
+ if (mod.events.error) {
+ notified = true;
+ mod.emit('error', err);
+ }
+ }
+ });
+
+ if (!notified) {
+ req.onError(err);
+ }
+ }
+ }
+
+ /**
+ * Internal method to transfer globalQueue items to this context's
+ * defQueue.
+ */
+ function takeGlobalQueue() {
+ //Push all the globalDefQueue items into the context's defQueue
+ if (globalDefQueue.length) {
+ //Array splice in the values since the context code has a
+ //local var ref to defQueue, so cannot just reassign the one
+ //on context.
+ apsp.apply(defQueue,
+ [defQueue.length - 1, 0].concat(globalDefQueue));
+ globalDefQueue = [];
+ }
+ }
+
+ handlers = {
+ 'require': function (mod) {
+ if (mod.require) {
+ return mod.require;
+ } else {
+ return (mod.require = context.makeRequire(mod.map));
+ }
+ },
+ 'exports': function (mod) {
+ mod.usingExports = true;
+ if (mod.map.isDefine) {
+ if (mod.exports) {
+ return mod.exports;
+ } else {
+ return (mod.exports = defined[mod.map.id] = {});
+ }
+ }
+ },
+ 'module': function (mod) {
+ if (mod.module) {
+ return mod.module;
+ } else {
+ return (mod.module = {
+ id: mod.map.id,
+ uri: mod.map.url,
+ config: function () {
+ var c,
+ pkg = getOwn(config.pkgs, mod.map.id);
+ // For packages, only support config targeted
+ // at the main module.
+ c = pkg ? getOwn(config.config, mod.map.id + '/' + pkg.main) :
+ getOwn(config.config, mod.map.id);
+ return c || {};
+ },
+ exports: defined[mod.map.id]
+ });
+ }
+ }
+ };
+
+ function cleanRegistry(id) {
+ //Clean up machinery used for waiting modules.
+ delete registry[id];
+ delete enabledRegistry[id];
+ }
+
+ function breakCycle(mod, traced, processed) {
+ var id = mod.map.id;
+
+ if (mod.error) {
+ mod.emit('error', mod.error);
+ } else {
+ traced[id] = true;
+ each(mod.depMaps, function (depMap, i) {
+ var depId = depMap.id,
+ dep = getOwn(registry, depId);
+
+ //Only force things that have not completed
+ //being defined, so still in the registry,
+ //and only if it has not been matched up
+ //in the module already.
+ if (dep && !mod.depMatched[i] && !processed[depId]) {
+ if (getOwn(traced, depId)) {
+ mod.defineDep(i, defined[depId]);
+ mod.check(); //pass false?
+ } else {
+ breakCycle(dep, traced, processed);
+ }
+ }
+ });
+ processed[id] = true;
+ }
+ }
+
+ function checkLoaded() {
+ var map, modId, err, usingPathFallback,
+ waitInterval = config.waitSeconds * 1000,
+ //It is possible to disable the wait interval by using waitSeconds of 0.
+ expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
+ noLoads = [],
+ reqCalls = [],
+ stillLoading = false,
+ needCycleCheck = true;
+
+ //Do not bother if this call was a result of a cycle break.
+ if (inCheckLoaded) {
+ return;
+ }
+
+ inCheckLoaded = true;
+
+ //Figure out the state of all the modules.
+ eachProp(enabledRegistry, function (mod) {
+ map = mod.map;
+ modId = map.id;
+
+ //Skip things that are not enabled or in error state.
+ if (!mod.enabled) {
+ return;
+ }
+
+ if (!map.isDefine) {
+ reqCalls.push(mod);
+ }
+
+ if (!mod.error) {
+ //If the module should be executed, and it has not
+ //been inited and time is up, remember it.
+ if (!mod.inited && expired) {
+ if (hasPathFallback(modId)) {
+ usingPathFallback = true;
+ stillLoading = true;
+ } else {
+ noLoads.push(modId);
+ removeScript(modId);
+ }
+ } else if (!mod.inited && mod.fetched && map.isDefine) {
+ stillLoading = true;
+ if (!map.prefix) {
+ //No reason to keep looking for unfinished
+ //loading. If the only stillLoading is a
+ //plugin resource though, keep going,
+ //because it may be that a plugin resource
+ //is waiting on a non-plugin cycle.
+ return (needCycleCheck = false);
+ }
+ }
+ }
+ });
+
+ if (expired && noLoads.length) {
+ //If wait time expired, throw error of unloaded modules.
+ err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads);
+ err.contextName = context.contextName;
+ return onError(err);
+ }
+
+ //Not expired, check for a cycle.
+ if (needCycleCheck) {
+ each(reqCalls, function (mod) {
+ breakCycle(mod, {}, {});
+ });
+ }
+
+ //If still waiting on loads, and the waiting load is something
+ //other than a plugin resource, or there are still outstanding
+ //scripts, then just try back later.
+ if ((!expired || usingPathFallback) && stillLoading) {
+ //Something is still waiting to load. Wait for it, but only
+ //if a timeout is not already in effect.
+ if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
+ checkLoadedTimeoutId = setTimeout(function () {
+ checkLoadedTimeoutId = 0;
+ checkLoaded();
+ }, 50);
+ }
+ }
+
+ inCheckLoaded = false;
+ }
+
+ Module = function (map) {
+ this.events = getOwn(undefEvents, map.id) || {};
+ this.map = map;
+ this.shim = getOwn(config.shim, map.id);
+ this.depExports = [];
+ this.depMaps = [];
+ this.depMatched = [];
+ this.pluginMaps = {};
+ this.depCount = 0;
+
+ /* this.exports this.factory
+ this.depMaps = [],
+ this.enabled, this.fetched
+ */
+ };
+
+ Module.prototype = {
+ init: function (depMaps, factory, errback, options) {
+ options = options || {};
+
+ //Do not do more inits if already done. Can happen if there
+ //are multiple define calls for the same module. That is not
+ //a normal, common case, but it is also not unexpected.
+ if (this.inited) {
+ return;
+ }
+
+ this.factory = factory;
+
+ if (errback) {
+ //Register for errors on this module.
+ this.on('error', errback);
+ } else if (this.events.error) {
+ //If no errback already, but there are error listeners
+ //on this module, set up an errback to pass to the deps.
+ errback = bind(this, function (err) {
+ this.emit('error', err);
+ });
+ }
+
+ //Do a copy of the dependency array, so that
+ //source inputs are not modified. For example
+ //"shim" deps are passed in here directly, and
+ //doing a direct modification of the depMaps array
+ //would affect that config.
+ this.depMaps = depMaps && depMaps.slice(0);
+
+ this.errback = errback;
+
+ //Indicate this module has be initialized
+ this.inited = true;
+
+ this.ignore = options.ignore;
+
+ //Could have option to init this module in enabled mode,
+ //or could have been previously marked as enabled. However,
+ //the dependencies are not known until init is called. So
+ //if enabled previously, now trigger dependencies as enabled.
+ if (options.enabled || this.enabled) {
+ //Enable this module and dependencies.
+ //Will call this.check()
+ this.enable();
+ } else {
+ this.check();
+ }
+ },
+
+ defineDep: function (i, depExports) {
+ //Because of cycles, defined callback for a given
+ //export can be called more than once.
+ if (!this.depMatched[i]) {
+ this.depMatched[i] = true;
+ this.depCount -= 1;
+ this.depExports[i] = depExports;
+ }
+ },
+
+ fetch: function () {
+ if (this.fetched) {
+ return;
+ }
+ this.fetched = true;
+
+ context.startTime = (new Date()).getTime();
+
+ var map = this.map;
+
+ //If the manager is for a plugin managed resource,
+ //ask the plugin to load it now.
+ if (this.shim) {
+ context.makeRequire(this.map, {
+ enableBuildCallback: true
+ })(this.shim.deps || [], bind(this, function () {
+ return map.prefix ? this.callPlugin() : this.load();
+ }));
+ } else {
+ //Regular dependency.
+ return map.prefix ? this.callPlugin() : this.load();
+ }
+ },
+
+ load: function () {
+ var url = this.map.url;
+
+ //Regular dependency.
+ if (!urlFetched[url]) {
+ urlFetched[url] = true;
+ context.load(this.map.id, url);
+ }
+ },
+
+ /**
+ * Checks if the module is ready to define itself, and if so,
+ * define it.
+ */
+ check: function () {
+ if (!this.enabled || this.enabling) {
+ return;
+ }
+
+ var err, cjsModule,
+ id = this.map.id,
+ depExports = this.depExports,
+ exports = this.exports,
+ factory = this.factory;
+
+ if (!this.inited) {
+ this.fetch();
+ } else if (this.error) {
+ this.emit('error', this.error);
+ } else if (!this.defining) {
+ //The factory could trigger another require call
+ //that would result in checking this module to
+ //define itself again. If already in the process
+ //of doing that, skip this work.
+ this.defining = true;
+
+ if (this.depCount < 1 && !this.defined) {
+ if (isFunction(factory)) {
+ //If there is an error listener, favor passing
+ //to that instead of throwing an error. However,
+ //only do it for define()'d modules. require
+ //errbacks should not be called for failures in
+ //their callbacks (#699). However if a global
+ //onError is set, use that.
+ if ((this.events.error && this.map.isDefine) ||
+ req.onError !== defaultOnError) {
+ try {
+ exports = context.execCb(id, factory, depExports, exports);
+ } catch (e) {
+ err = e;
+ }
+ } else {
+ exports = context.execCb(id, factory, depExports, exports);
+ }
+
+ if (this.map.isDefine) {
+ //If setting exports via 'module' is in play,
+ //favor that over return value and exports. After that,
+ //favor a non-undefined return value over exports use.
+ cjsModule = this.module;
+ if (cjsModule &&
+ cjsModule.exports !== undefined &&
+ //Make sure it is not already the exports value
+ cjsModule.exports !== this.exports) {
+ exports = cjsModule.exports;
+ } else if (exports === undefined && this.usingExports) {
+ //exports already set the defined value.
+ exports = this.exports;
+ }
+ }
+
+ if (err) {
+ err.requireMap = this.map;
+ err.requireModules = this.map.isDefine ? [this.map.id] : null;
+ err.requireType = this.map.isDefine ? 'define' : 'require';
+ return onError((this.error = err));
+ }
+
+ } else {
+ //Just a literal value
+ exports = factory;
+ }
+
+ this.exports = exports;
+
+ if (this.map.isDefine && !this.ignore) {
+ defined[id] = exports;
+
+ if (req.onResourceLoad) {
+ req.onResourceLoad(context, this.map, this.depMaps);
+ }
+ }
+
+ //Clean up
+ cleanRegistry(id);
+
+ this.defined = true;
+ }
+
+ //Finished the define stage. Allow calling check again
+ //to allow define notifications below in the case of a
+ //cycle.
+ this.defining = false;
+
+ if (this.defined && !this.defineEmitted) {
+ this.defineEmitted = true;
+ this.emit('defined', this.exports);
+ this.defineEmitComplete = true;
+ }
+
+ }
+ },
+
+ callPlugin: function () {
+ var map = this.map,
+ id = map.id,
+ //Map already normalized the prefix.
+ pluginMap = makeModuleMap(map.prefix);
+
+ //Mark this as a dependency for this plugin, so it
+ //can be traced for cycles.
+ this.depMaps.push(pluginMap);
+
+ on(pluginMap, 'defined', bind(this, function (plugin) {
+ var load, normalizedMap, normalizedMod,
+ name = this.map.name,
+ parentName = this.map.parentMap ? this.map.parentMap.name : null,
+ localRequire = context.makeRequire(map.parentMap, {
+ enableBuildCallback: true
+ });
+
+ //If current map is not normalized, wait for that
+ //normalized name to load instead of continuing.
+ if (this.map.unnormalized) {
+ //Normalize the ID if the plugin allows it.
+ if (plugin.normalize) {
+ name = plugin.normalize(name, function (name) {
+ return normalize(name, parentName, true);
+ }) || '';
+ }
+
+ //prefix and name should already be normalized, no need
+ //for applying map config again either.
+ normalizedMap = makeModuleMap(map.prefix + '!' + name,
+ this.map.parentMap);
+ on(normalizedMap,
+ 'defined', bind(this, function (value) {
+ this.init([], function () { return value; }, null, {
+ enabled: true,
+ ignore: true
+ });
+ }));
+
+ normalizedMod = getOwn(registry, normalizedMap.id);
+ if (normalizedMod) {
+ //Mark this as a dependency for this plugin, so it
+ //can be traced for cycles.
+ this.depMaps.push(normalizedMap);
+
+ if (this.events.error) {
+ normalizedMod.on('error', bind(this, function (err) {
+ this.emit('error', err);
+ }));
+ }
+ normalizedMod.enable();
+ }
+
+ return;
+ }
+
+ load = bind(this, function (value) {
+ this.init([], function () { return value; }, null, {
+ enabled: true
+ });
+ });
+
+ load.error = bind(this, function (err) {
+ this.inited = true;
+ this.error = err;
+ err.requireModules = [id];
+
+ //Remove temp unnormalized modules for this module,
+ //since they will never be resolved otherwise now.
+ eachProp(registry, function (mod) {
+ if (mod.map.id.indexOf(id + '_unnormalized') === 0) {
+ cleanRegistry(mod.map.id);
+ }
+ });
+
+ onError(err);
+ });
+
+ //Allow plugins to load other code without having to know the
+ //context or how to 'complete' the load.
+ load.fromText = bind(this, function (text, textAlt) {
+ /*jslint evil: true */
+ var moduleName = map.name,
+ moduleMap = makeModuleMap(moduleName),
+ hasInteractive = useInteractive;
+
+ //As of 2.1.0, support just passing the text, to reinforce
+ //fromText only being called once per resource. Still
+ //support old style of passing moduleName but discard
+ //that moduleName in favor of the internal ref.
+ if (textAlt) {
+ text = textAlt;
+ }
+
+ //Turn off interactive script matching for IE for any define
+ //calls in the text, then turn it back on at the end.
+ if (hasInteractive) {
+ useInteractive = false;
+ }
+
+ //Prime the system by creating a module instance for
+ //it.
+ getModule(moduleMap);
+
+ //Transfer any config to this other module.
+ if (hasProp(config.config, id)) {
+ config.config[moduleName] = config.config[id];
+ }
+
+ try {
+ req.exec(text);
+ } catch (e) {
+ return onError(makeError('fromtexteval',
+ 'fromText eval for ' + id +
+ ' failed: ' + e,
+ e,
+ [id]));
+ }
+
+ if (hasInteractive) {
+ useInteractive = true;
+ }
+
+ //Mark this as a dependency for the plugin
+ //resource
+ this.depMaps.push(moduleMap);
+
+ //Support anonymous modules.
+ context.completeLoad(moduleName);
+
+ //Bind the value of that module to the value for this
+ //resource ID.
+ localRequire([moduleName], load);
+ });
+
+ //Use parentName here since the plugin's name is not reliable,
+ //could be some weird string with no path that actually wants to
+ //reference the parentName's path.
+ plugin.load(map.name, localRequire, load, config);
+ }));
+
+ context.enable(pluginMap, this);
+ this.pluginMaps[pluginMap.id] = pluginMap;
+ },
+
+ enable: function () {
+ enabledRegistry[this.map.id] = this;
+ this.enabled = true;
+
+ //Set flag mentioning that the module is enabling,
+ //so that immediate calls to the defined callbacks
+ //for dependencies do not trigger inadvertent load
+ //with the depCount still being zero.
+ this.enabling = true;
+
+ //Enable each dependency
+ each(this.depMaps, bind(this, function (depMap, i) {
+ var id, mod, handler;
+
+ if (typeof depMap === 'string') {
+ //Dependency needs to be converted to a depMap
+ //and wired up to this module.
+ depMap = makeModuleMap(depMap,
+ (this.map.isDefine ? this.map : this.map.parentMap),
+ false,
+ !this.skipMap);
+ this.depMaps[i] = depMap;
+
+ handler = getOwn(handlers, depMap.id);
+
+ if (handler) {
+ this.depExports[i] = handler(this);
+ return;
+ }
+
+ this.depCount += 1;
+
+ on(depMap, 'defined', bind(this, function (depExports) {
+ this.defineDep(i, depExports);
+ this.check();
+ }));
+
+ if (this.errback) {
+ on(depMap, 'error', bind(this, this.errback));
+ }
+ }
+
+ id = depMap.id;
+ mod = registry[id];
+
+ //Skip special modules like 'require', 'exports', 'module'
+ //Also, don't call enable if it is already enabled,
+ //important in circular dependency cases.
+ if (!hasProp(handlers, id) && mod && !mod.enabled) {
+ context.enable(depMap, this);
+ }
+ }));
+
+ //Enable each plugin that is used in
+ //a dependency
+ eachProp(this.pluginMaps, bind(this, function (pluginMap) {
+ var mod = getOwn(registry, pluginMap.id);
+ if (mod && !mod.enabled) {
+ context.enable(pluginMap, this);
+ }
+ }));
+
+ this.enabling = false;
+
+ this.check();
+ },
+
+ on: function (name, cb) {
+ var cbs = this.events[name];
+ if (!cbs) {
+ cbs = this.events[name] = [];
+ }
+ cbs.push(cb);
+ },
+
+ emit: function (name, evt) {
+ each(this.events[name], function (cb) {
+ cb(evt);
+ });
+ if (name === 'error') {
+ //Now that the error handler was triggered, remove
+ //the listeners, since this broken Module instance
+ //can stay around for a while in the registry.
+ delete this.events[name];
+ }
+ }
+ };
+
+ function callGetModule(args) {
+ //Skip modules already defined.
+ if (!hasProp(defined, args[0])) {
+ getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]);
+ }
+ }
+
+ function removeListener(node, func, name, ieName) {
+ //Favor detachEvent because of IE9
+ //issue, see attachEvent/addEventListener comment elsewhere
+ //in this file.
+ if (node.detachEvent && !isOpera) {
+ //Probably IE. If not it will throw an error, which will be
+ //useful to know.
+ if (ieName) {
+ node.detachEvent(ieName, func);
+ }
+ } else {
+ node.removeEventListener(name, func, false);
+ }
+ }
+
+ /**
+ * Given an event from a script node, get the requirejs info from it,
+ * and then removes the event listeners on the node.
+ * @param {Event} evt
+ * @returns {Object}
+ */
+ function getScriptData(evt) {
+ //Using currentTarget instead of target for Firefox 2.0's sake. Not
+ //all old browsers will be supported, but this one was easy enough
+ //to support and still makes sense.
+ var node = evt.currentTarget || evt.srcElement;
+
+ //Remove the listeners once here.
+ removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange');
+ removeListener(node, context.onScriptError, 'error');
+
+ return {
+ node: node,
+ id: node && node.getAttribute('data-requiremodule')
+ };
+ }
+
+ function intakeDefines() {
+ var args;
+
+ //Any defined modules in the global queue, intake them now.
+ takeGlobalQueue();
+
+ //Make sure any remaining defQueue items get properly processed.
+ while (defQueue.length) {
+ args = defQueue.shift();
+ if (args[0] === null) {
+ return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
+ } else {
+ //args are id, deps, factory. Should be normalized by the
+ //define() function.
+ callGetModule(args);
+ }
+ }
+ }
+
+ context = {
+ config: config,
+ contextName: contextName,
+ registry: registry,
+ defined: defined,
+ urlFetched: urlFetched,
+ defQueue: defQueue,
+ Module: Module,
+ makeModuleMap: makeModuleMap,
+ nextTick: req.nextTick,
+ onError: onError,
+
+ /**
+ * Set a configuration for the context.
+ * @param {Object} cfg config object to integrate.
+ */
+ configure: function (cfg) {
+ //Make sure the baseUrl ends in a slash.
+ if (cfg.baseUrl) {
+ if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') {
+ cfg.baseUrl += '/';
+ }
+ }
+
+ //Save off the paths and packages since they require special processing,
+ //they are additive.
+ var pkgs = config.pkgs,
+ shim = config.shim,
+ objs = {
+ paths: true,
+ config: true,
+ map: true
+ };
+
+ eachProp(cfg, function (value, prop) {
+ if (objs[prop]) {
+ if (prop === 'map') {
+ if (!config.map) {
+ config.map = {};
+ }
+ mixin(config[prop], value, true, true);
+ } else {
+ mixin(config[prop], value, true);
+ }
+ } else {
+ config[prop] = value;
+ }
+ });
+
+ //Merge shim
+ if (cfg.shim) {
+ eachProp(cfg.shim, function (value, id) {
+ //Normalize the structure
+ if (isArray(value)) {
+ value = {
+ deps: value
+ };
+ }
+ if ((value.exports || value.init) && !value.exportsFn) {
+ value.exportsFn = context.makeShimExports(value);
+ }
+ shim[id] = value;
+ });
+ config.shim = shim;
+ }
+
+ //Adjust packages if necessary.
+ if (cfg.packages) {
+ each(cfg.packages, function (pkgObj) {
+ var location;
+
+ pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj;
+ location = pkgObj.location;
+
+ //Create a brand new object on pkgs, since currentPackages can
+ //be passed in again, and config.pkgs is the internal transformed
+ //state for all package configs.
+ pkgs[pkgObj.name] = {
+ name: pkgObj.name,
+ location: location || pkgObj.name,
+ //Remove leading dot in main, so main paths are normalized,
+ //and remove any trailing .js, since different package
+ //envs have different conventions: some use a module name,
+ //some use a file name.
+ main: (pkgObj.main || 'main')
+ .replace(currDirRegExp, '')
+ .replace(jsSuffixRegExp, '')
+ };
+ });
+
+ //Done with modifications, assing packages back to context config
+ config.pkgs = pkgs;
+ }
+
+ //If there are any "waiting to execute" modules in the registry,
+ //update the maps for them, since their info, like URLs to load,
+ //may have changed.
+ eachProp(registry, function (mod, id) {
+ //If module already has init called, since it is too
+ //late to modify them, and ignore unnormalized ones
+ //since they are transient.
+ if (!mod.inited && !mod.map.unnormalized) {
+ mod.map = makeModuleMap(id);
+ }
+ });
+
+ //If a deps array or a config callback is specified, then call
+ //require with those args. This is useful when require is defined as a
+ //config object before require.js is loaded.
+ if (cfg.deps || cfg.callback) {
+ context.require(cfg.deps || [], cfg.callback);
+ }
+ },
+
+ makeShimExports: function (value) {
+ function fn() {
+ var ret;
+ if (value.init) {
+ ret = value.init.apply(global, arguments);
+ }
+ return ret || (value.exports && getGlobal(value.exports));
+ }
+ return fn;
+ },
+
+ makeRequire: function (relMap, options) {
+ options = options || {};
+
+ function localRequire(deps, callback, errback) {
+ var id, map, requireMod;
+
+ if (options.enableBuildCallback && callback && isFunction(callback)) {
+ callback.__requireJsBuild = true;
+ }
+
+ if (typeof deps === 'string') {
+ if (isFunction(callback)) {
+ //Invalid call
+ return onError(makeError('requireargs', 'Invalid require call'), errback);
+ }
+
+ //If require|exports|module are requested, get the
+ //value for them from the special handlers. Caveat:
+ //this only works while module is being defined.
+ if (relMap && hasProp(handlers, deps)) {
+ return handlers[deps](registry[relMap.id]);
+ }
+
+ //Synchronous access to one module. If require.get is
+ //available (as in the Node adapter), prefer that.
+ if (req.get) {
+ return req.get(context, deps, relMap, localRequire);
+ }
+
+ //Normalize module name, if it contains . or ..
+ map = makeModuleMap(deps, relMap, false, true);
+ id = map.id;
+
+ if (!hasProp(defined, id)) {
+ return onError(makeError('notloaded', 'Module name "' +
+ id +
+ '" has not been loaded yet for context: ' +
+ contextName +
+ (relMap ? '' : '. Use require([])')));
+ }
+ return defined[id];
+ }
+
+ //Grab defines waiting in the global queue.
+ intakeDefines();
+
+ //Mark all the dependencies as needing to be loaded.
+ context.nextTick(function () {
+ //Some defines could have been added since the
+ //require call, collect them.
+ intakeDefines();
+
+ requireMod = getModule(makeModuleMap(null, relMap));
+
+ //Store if map config should be applied to this require
+ //call for dependencies.
+ requireMod.skipMap = options.skipMap;
+
+ requireMod.init(deps, callback, errback, {
+ enabled: true
+ });
+
+ checkLoaded();
+ });
+
+ return localRequire;
+ }
+
+ mixin(localRequire, {
+ isBrowser: isBrowser,
+
+ /**
+ * Converts a module name + .extension into an URL path.
+ * *Requires* the use of a module name. It does not support using
+ * plain URLs like nameToUrl.
+ */
+ toUrl: function (moduleNamePlusExt) {
+ var ext,
+ index = moduleNamePlusExt.lastIndexOf('.'),
+ segment = moduleNamePlusExt.split('/')[0],
+ isRelative = segment === '.' || segment === '..';
+
+ //Have a file extension alias, and it is not the
+ //dots from a relative path.
+ if (index !== -1 && (!isRelative || index > 1)) {
+ ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
+ moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
+ }
+
+ return context.nameToUrl(normalize(moduleNamePlusExt,
+ relMap && relMap.id, true), ext, true);
+ },
+
+ defined: function (id) {
+ return hasProp(defined, makeModuleMap(id, relMap, false, true).id);
+ },
+
+ specified: function (id) {
+ id = makeModuleMap(id, relMap, false, true).id;
+ return hasProp(defined, id) || hasProp(registry, id);
+ }
+ });
+
+ //Only allow undef on top level require calls
+ if (!relMap) {
+ localRequire.undef = function (id) {
+ //Bind any waiting define() calls to this context,
+ //fix for #408
+ takeGlobalQueue();
+
+ var map = makeModuleMap(id, relMap, true),
+ mod = getOwn(registry, id);
+
+ delete defined[id];
+ delete urlFetched[map.url];
+ delete undefEvents[id];
+
+ if (mod) {
+ //Hold on to listeners in case the
+ //module will be attempted to be reloaded
+ //using a different config.
+ if (mod.events.defined) {
+ undefEvents[id] = mod.events;
+ }
+
+ cleanRegistry(id);
+ }
+ };
+ }
+
+ return localRequire;
+ },
+
+ /**
+ * Called to enable a module if it is still in the registry
+ * awaiting enablement. A second arg, parent, the parent module,
+ * is passed in for context, when this method is overriden by
+ * the optimizer. Not shown here to keep code compact.
+ */
+ enable: function (depMap) {
+ var mod = getOwn(registry, depMap.id);
+ if (mod) {
+ getModule(depMap).enable();
+ }
+ },
+
+ /**
+ * Internal method used by environment adapters to complete a load event.
+ * A load event could be a script load or just a load pass from a synchronous
+ * load call.
+ * @param {String} moduleName the name of the module to potentially complete.
+ */
+ completeLoad: function (moduleName) {
+ var found, args, mod,
+ shim = getOwn(config.shim, moduleName) || {},
+ shExports = shim.exports;
+
+ takeGlobalQueue();
+
+ while (defQueue.length) {
+ args = defQueue.shift();
+ if (args[0] === null) {
+ args[0] = moduleName;
+ //If already found an anonymous module and bound it
+ //to this name, then this is some other anon module
+ //waiting for its completeLoad to fire.
+ if (found) {
+ break;
+ }
+ found = true;
+ } else if (args[0] === moduleName) {
+ //Found matching define call for this script!
+ found = true;
+ }
+
+ callGetModule(args);
+ }
+
+ //Do this after the cycle of callGetModule in case the result
+ //of those calls/init calls changes the registry.
+ mod = getOwn(registry, moduleName);
+
+ if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) {
+ if (config.enforceDefine && (!shExports || !getGlobal(shExports))) {
+ if (hasPathFallback(moduleName)) {
+ return;
+ } else {
+ return onError(makeError('nodefine',
+ 'No define call for ' + moduleName,
+ null,
+ [moduleName]));
+ }
+ } else {
+ //A script that does not call define(), so just simulate
+ //the call for it.
+ callGetModule([moduleName, (shim.deps || []), shim.exportsFn]);
+ }
+ }
+
+ checkLoaded();
+ },
+
+ /**
+ * Converts a module name to a file path. Supports cases where
+ * moduleName may actually be just an URL.
+ * Note that it **does not** call normalize on the moduleName,
+ * it is assumed to have already been normalized. This is an
+ * internal API, not a public one. Use toUrl for the public API.
+ */
+ nameToUrl: function (moduleName, ext, skipExt) {
+ var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
+ parentPath;
+
+ //If a colon is in the URL, it indicates a protocol is used and it is just
+ //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?)
+ //or ends with .js, then assume the user meant to use an url and not a module id.
+ //The slash is important for protocol-less URLs as well as full paths.
+ if (req.jsExtRegExp.test(moduleName)) {
+ //Just a plain path, not module name lookup, so just return it.
+ //Add extension if it is included. This is a bit wonky, only non-.js things pass
+ //an extension, this method probably needs to be reworked.
+ url = moduleName + (ext || '');
+ } else {
+ //A module that needs to be converted to a path.
+ paths = config.paths;
+ pkgs = config.pkgs;
+
+ syms = moduleName.split('/');
+ //For each module name segment, see if there is a path
+ //registered for it. Start with most specific name
+ //and work up from it.
+ for (i = syms.length; i > 0; i -= 1) {
+ parentModule = syms.slice(0, i).join('/');
+ pkg = getOwn(pkgs, parentModule);
+ parentPath = getOwn(paths, parentModule);
+ if (parentPath) {
+ //If an array, it means there are a few choices,
+ //Choose the one that is desired
+ if (isArray(parentPath)) {
+ parentPath = parentPath[0];
+ }
+ syms.splice(0, i, parentPath);
+ break;
+ } else if (pkg) {
+ //If module name is just the package name, then looking
+ //for the main module.
+ if (moduleName === pkg.name) {
+ pkgPath = pkg.location + '/' + pkg.main;
+ } else {
+ pkgPath = pkg.location;
+ }
+ syms.splice(0, i, pkgPath);
+ break;
+ }
+ }
+
+ //Join the path parts together, then figure out if baseUrl is needed.
+ url = syms.join('/');
+ url += (ext || (/\?/.test(url) || skipExt ? '' : '.js'));
+ url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url;
+ }
+
+ return config.urlArgs ? url +
+ ((url.indexOf('?') === -1 ? '?' : '&') +
+ config.urlArgs) : url;
+ },
+
+ //Delegates to req.load. Broken out as a separate function to
+ //allow overriding in the optimizer.
+ load: function (id, url) {
+ req.load(context, id, url);
+ },
+
+ /**
+ * Executes a module callback function. Broken out as a separate function
+ * solely to allow the build system to sequence the files in the built
+ * layer in the right sequence.
+ *
+ * @private
+ */
+ execCb: function (name, callback, args, exports) {
+ return callback.apply(exports, args);
+ },
+
+ /**
+ * callback for script loads, used to check status of loading.
+ *
+ * @param {Event} evt the event from the browser for the script
+ * that was loaded.
+ */
+ onScriptLoad: function (evt) {
+ //Using currentTarget instead of target for Firefox 2.0's sake. Not
+ //all old browsers will be supported, but this one was easy enough
+ //to support and still makes sense.
+ if (evt.type === 'load' ||
+ (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) {
+ //Reset interactive script so a script node is not held onto for
+ //to long.
+ interactiveScript = null;
+
+ //Pull out the name of the module and the context.
+ var data = getScriptData(evt);
+ context.completeLoad(data.id);
+ }
+ },
+
+ /**
+ * Callback for script errors.
+ */
+ onScriptError: function (evt) {
+ var data = getScriptData(evt);
+ if (!hasPathFallback(data.id)) {
+ return onError(makeError('scripterror', 'Script error for: ' + data.id, evt, [data.id]));
+ }
+ }
+ };
+
+ context.require = context.makeRequire();
+ return context;
+ }
+
+ /**
+ * Main entry point.
+ *
+ * If the only argument to require is a string, then the module that
+ * is represented by that string is fetched for the appropriate context.
+ *
+ * If the first argument is an array, then it will be treated as an array
+ * of dependency string names to fetch. An optional function callback can
+ * be specified to execute when all of those dependencies are available.
+ *
+ * Make a local req variable to help Caja compliance (it assumes things
+ * on a require that are not standardized), and to give a short
+ * name for minification/local scope use.
+ */
+ req = requirejs = function (deps, callback, errback, optional) {
+
+ //Find the right context, use default
+ var context, config,
+ contextName = defContextName;
+
+ // Determine if have config object in the call.
+ if (!isArray(deps) && typeof deps !== 'string') {
+ // deps is a config object
+ config = deps;
+ if (isArray(callback)) {
+ // Adjust args if there are dependencies
+ deps = callback;
+ callback = errback;
+ errback = optional;
+ } else {
+ deps = [];
+ }
+ }
+
+ if (config && config.context) {
+ contextName = config.context;
+ }
+
+ context = getOwn(contexts, contextName);
+ if (!context) {
+ context = contexts[contextName] = req.s.newContext(contextName);
+ }
+
+ if (config) {
+ context.configure(config);
+ }
+
+ return context.require(deps, callback, errback);
+ };
+
+ /**
+ * Support require.config() to make it easier to cooperate with other
+ * AMD loaders on globally agreed names.
+ */
+ req.config = function (config) {
+ return req(config);
+ };
+
+ /**
+ * Execute something after the current tick
+ * of the event loop. Override for other envs
+ * that have a better solution than setTimeout.
+ * @param {Function} fn function to execute later.
+ */
+ req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) {
+ setTimeout(fn, 4);
+ } : function (fn) { fn(); };
+
+ /**
+ * Export require as a global, but only if it does not already exist.
+ */
+ if (!require) {
+ require = req;
+ }
+
+ req.version = version;
+
+ //Used to filter out dependencies that are already paths.
+ req.jsExtRegExp = /^\/|:|\?|\.js$/;
+ req.isBrowser = isBrowser;
+ s = req.s = {
+ contexts: contexts,
+ newContext: newContext
+ };
+
+ //Create default context.
+ req({});
+
+ //Exports some context-sensitive methods on global require.
+ each([
+ 'toUrl',
+ 'undef',
+ 'defined',
+ 'specified'
+ ], function (prop) {
+ //Reference from contexts instead of early binding to default context,
+ //so that during builds, the latest instance of the default context
+ //with its config gets used.
+ req[prop] = function () {
+ var ctx = contexts[defContextName];
+ return ctx.require[prop].apply(ctx, arguments);
+ };
+ });
+
+ if (isBrowser) {
+ head = s.head = document.getElementsByTagName('head')[0];
+ //If BASE tag is in play, using appendChild is a problem for IE6.
+ //When that browser dies, this can be removed. Details in this jQuery bug:
+ //http://dev.jquery.com/ticket/2709
+ baseElement = document.getElementsByTagName('base')[0];
+ if (baseElement) {
+ head = s.head = baseElement.parentNode;
+ }
+ }
+
+ /**
+ * Any errors that require explicitly generates will be passed to this
+ * function. Intercept/override it if you want custom error handling.
+ * @param {Error} err the error object.
+ */
+ req.onError = defaultOnError;
+
+ /**
+ * Creates the node for the load command. Only used in browser envs.
+ */
+ req.createNode = function (config, moduleName, url) {
+ var node = config.xhtml ?
+ document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') :
+ document.createElement('script');
+ node.type = config.scriptType || 'text/javascript';
+ node.charset = 'utf-8';
+ node.async = true;
+ return node;
+ };
+
+ /**
+ * Does the request to load a module for the browser case.
+ * Make this a separate function to allow other environments
+ * to override it.
+ *
+ * @param {Object} context the require context to find state.
+ * @param {String} moduleName the name of the module.
+ * @param {Object} url the URL to the module.
+ */
+ req.load = function (context, moduleName, url) {
+ var config = (context && context.config) || {},
+ node;
+ if (isBrowser) {
+ //In the browser so use a script tag
+ node = req.createNode(config, moduleName, url);
+
+ node.setAttribute('data-requirecontext', context.contextName);
+ node.setAttribute('data-requiremodule', moduleName);
+
+ //Set up load listener. Test attachEvent first because IE9 has
+ //a subtle issue in its addEventListener and script onload firings
+ //that do not match the behavior of all other browsers with
+ //addEventListener support, which fire the onload event for a
+ //script right after the script execution. See:
+ //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution
+ //UNFORTUNATELY Opera implements attachEvent but does not follow the script
+ //script execution mode.
+ if (node.attachEvent &&
+ //Check if node.attachEvent is artificially added by custom script or
+ //natively supported by browser
+ //read https://github.com/jrburke/requirejs/issues/187
+ //if we can NOT find [native code] then it must NOT natively supported.
+ //in IE8, node.attachEvent does not have toString()
+ //Note the test for "[native code" with no closing brace, see:
+ //https://github.com/jrburke/requirejs/issues/273
+ !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) &&
+ !isOpera) {
+ //Probably IE. IE (at least 6-8) do not fire
+ //script onload right after executing the script, so
+ //we cannot tie the anonymous define call to a name.
+ //However, IE reports the script as being in 'interactive'
+ //readyState at the time of the define call.
+ useInteractive = true;
+
+ node.attachEvent('onreadystatechange', context.onScriptLoad);
+ //It would be great to add an error handler here to catch
+ //404s in IE9+. However, onreadystatechange will fire before
+ //the error handler, so that does not help. If addEventListener
+ //is used, then IE will fire error before load, but we cannot
+ //use that pathway given the connect.microsoft.com issue
+ //mentioned above about not doing the 'script execute,
+ //then fire the script load event listener before execute
+ //next script' that other browsers do.
+ //Best hope: IE10 fixes the issues,
+ //and then destroys all installs of IE 6-9.
+ //node.attachEvent('onerror', context.onScriptError);
+ } else {
+ node.addEventListener('load', context.onScriptLoad, false);
+ node.addEventListener('error', context.onScriptError, false);
+ }
+ node.src = url;
+
+ //For some cache cases in IE 6-8, the script executes before the end
+ //of the appendChild execution, so to tie an anonymous define
+ //call to the module name (which is stored on the node), hold on
+ //to a reference to this node, but clear after the DOM insertion.
+ currentlyAddingScript = node;
+ if (baseElement) {
+ head.insertBefore(node, baseElement);
+ } else {
+ head.appendChild(node);
+ }
+ currentlyAddingScript = null;
+
+ return node;
+ } else if (isWebWorker) {
+ try {
+ //In a web worker, use importScripts. This is not a very
+ //efficient use of importScripts, importScripts will block until
+ //its script is downloaded and evaluated. However, if web workers
+ //are in play, the expectation that a build has been done so that
+ //only one script needs to be loaded anyway. This may need to be
+ //reevaluated if other use cases become common.
+ importScripts(url);
+
+ //Account for anonymous modules
+ context.completeLoad(moduleName);
+ } catch (e) {
+ context.onError(makeError('importscripts',
+ 'importScripts failed for ' +
+ moduleName + ' at ' + url,
+ e,
+ [moduleName]));
+ }
+ }
+ };
+
+ function getInteractiveScript() {
+ if (interactiveScript && interactiveScript.readyState === 'interactive') {
+ return interactiveScript;
+ }
+
+ eachReverse(scripts(), function (script) {
+ if (script.readyState === 'interactive') {
+ return (interactiveScript = script);
+ }
+ });
+ return interactiveScript;
+ }
+
+ //Look for a data-main script attribute, which could also adjust the baseUrl.
+ if (isBrowser) {
+ //Figure out baseUrl. Get it from the script tag with require.js in it.
+ eachReverse(scripts(), function (script) {
+ //Set the 'head' where we can append children by
+ //using the script's parent.
+ if (!head) {
+ head = script.parentNode;
+ }
+
+ //Look for a data-main attribute to set main script for the page
+ //to load. If it is there, the path to data main becomes the
+ //baseUrl, if it is not already set.
+ dataMain = script.getAttribute('data-main');
+ if (dataMain) {
+ //Preserve dataMain in case it is a path (i.e. contains '?')
+ mainScript = dataMain;
+
+ //Set final baseUrl if there is not already an explicit one.
+ if (!cfg.baseUrl) {
+ //Pull off the directory of data-main for use as the
+ //baseUrl.
+ src = mainScript.split('/');
+ mainScript = src.pop();
+ subPath = src.length ? src.join('/') + '/' : './';
+
+ cfg.baseUrl = subPath;
+ }
+
+ //Strip off any trailing .js since mainScript is now
+ //like a module name.
+ mainScript = mainScript.replace(jsSuffixRegExp, '');
+
+ //If mainScript is still a path, fall back to dataMain
+ if (req.jsExtRegExp.test(mainScript)) {
+ mainScript = dataMain;
+ }
+
+ //Put the data-main script in the files to load.
+ cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript];
+
+ return true;
+ }
+ });
+ }
+
+ /**
+ * The function that handles definitions of modules. Differs from
+ * require() in that a string for the module should be the first argument,
+ * and the function to execute after dependencies are loaded should
+ * return a value to define the module corresponding to the first argument's
+ * name.
+ */
+ define = function (name, deps, callback) {
+ var node, context;
+
+ //Allow for anonymous modules
+ if (typeof name !== 'string') {
+ //Adjust args appropriately
+ callback = deps;
+ deps = name;
+ name = null;
+ }
+
+ //This module may not have dependencies
+ if (!isArray(deps)) {
+ callback = deps;
+ deps = null;
+ }
+
+ //If no name, and callback is a function, then figure out if it a
+ //CommonJS thing with dependencies.
+ if (!deps && isFunction(callback)) {
+ deps = [];
+ //Remove comments from the callback string,
+ //look for require calls, and pull them into the dependencies,
+ //but only if there are function args.
+ if (callback.length) {
+ callback
+ .toString()
+ .replace(commentRegExp, '')
+ .replace(cjsRequireRegExp, function (match, dep) {
+ deps.push(dep);
+ });
+
+ //May be a CommonJS thing even without require calls, but still
+ //could use exports, and module. Avoid doing exports and module
+ //work though if it just needs require.
+ //REQUIRES the function to expect the CommonJS variables in the
+ //order listed below.
+ deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps);
+ }
+ }
+
+ //If in IE 6-8 and hit an anonymous define() call, do the interactive
+ //work.
+ if (useInteractive) {
+ node = currentlyAddingScript || getInteractiveScript();
+ if (node) {
+ if (!name) {
+ name = node.getAttribute('data-requiremodule');
+ }
+ context = contexts[node.getAttribute('data-requirecontext')];
+ }
+ }
+
+ //Always save off evaluating the def call until the script onload handler.
+ //This allows multiple modules to be in a file without prematurely
+ //tracing dependencies, and allows for anonymous module support,
+ //where the module name is not known until the script onload event
+ //occurs. If no context, use the global queue, and get it processed
+ //in the onscript load callback.
+ (context ? context.defQueue : globalDefQueue).push([name, deps, callback]);
+ };
+
+ define.amd = {
+ jQuery: true
+ };
+
+
+ /**
+ * Executes the text. Normally just uses eval, but can be modified
+ * to use a better, environment-specific call. Only used for transpiling
+ * loader plugins, not for plain JS modules.
+ * @param {String} text the text to execute/evaluate.
+ */
+ req.exec = function (text) {
+ /*jslint evil: true */
+ return eval(text);
+ };
+
+ //Set up with config info.
+ req(cfg);
+}(this));
+
+define("requireLib", function(){});
+
+
+define('common/util',['require','exports','module'],function(require, exports, module) {
+
+ //Empty init
+ var initEmpty = function(){};
+
+ //Proxy Constructor (for once)
+ var Proxy = function(x){
+ util.defineProperty(this,'_protoOf',{value:x});
+ };
+
+ var util = {
+
+ is : function(o, type){
+ return ({}).toString.call(o) === '[object '+type+']';
+ },
+
+ defineProperty : function(obj, prop, descriptor){
+ if(typeof Object.defineProperty==='function'){
+ Object.defineProperty(obj, prop, descriptor);
+ }else{
+ obj[prop] = descriptor.value;
+ }
+ },
+
+ copyOwnProperties : function(src, target){
+ if(src instanceof Object){
+ var k;
+ for(k in src){
+ if(src.hasOwnProperty(k)){
+ target[k] = src[k];
+ }
+ }
+ }
+ },
+
+ /**
+ * Define Class
+ *
+ * @method defineClass
+ * @param {Object} p
+ * @returns {Function} Constructor
+ */
+ Class : function(p) {
+
+ var dynamics = p.dynamics || {},
+ statics = p.statics || {};
+ dynamics.init = p.init || initEmpty;
+
+ //Constructor
+ var Clazz = function(){
+ util.defineProperty(this,'_type',{value:p.name||''});
+ if(Clazz.prototype.hasOwnProperty('init')){
+ Clazz.prototype.init.apply(this, arguments);
+ }
+ };
+
+ //Extend Dynamics
+ var Extend = p.extend || Object;
+ Proxy.prototype = Extend.prototype;
+ Clazz.prototype = new Proxy(p.name);
+ this.defineProperty(Clazz.prototype,'constructor',{value:Clazz});
+
+ //Extend Statics
+ this.copyOwnProperties(Extend, Clazz);
+
+ // overwrite Extend.super
+ this.defineProperty(Clazz,'super',{value:Extend.prototype});
+
+ //Add Dynamics
+ this.copyOwnProperties(dynamics, Clazz.prototype);
+
+ //Add Statics (if exist override)
+ this.copyOwnProperties(statics, Clazz);
+
+ return Clazz;
+ },
+
+ /**
+ * Define Interface
+ *
+ * @param {Object} p
+ * @returns {Function} Constructor Function
+ */
+ Interface : function(p) {
+ //TODO
+ }
+ };
+
+ module.exports = util;
+});
+
+
+define('common/string',['require','exports','module'],function(require, exports, module) {
+
+ module.exports = {
+ trim : function(str){
+ return str.replace(/^\s+|\s+$/g, '');
+ },
+ ucFirst : function(str){
+ return str.substr(0,1).toUpperCase() + str.substr(1);
+ },
+ getRandomColor : function () {
+ var letters = '0123456789ABCDEF'.split('');
+ var color = '#';
+ for (var i = 0; i < 6; i++ ) {
+ color += letters[Math.round(Math.random() * 15)];
+ }
+ return color;
+ },
+ round : function(str, precision){
+
+ var power = Math.pow(10,precision);
+
+ return Math.round(parseFloat(str)*power)/power;
+ },
+ getRandomNum : function(start, end){
+ var diff = end - start;
+ return Math.round(Math.random()*diff)+start;
+ }
+ }
+
+});
+
+
+define('bases/Registry',['require','exports','module'],function(require, exports, module) {
+
+ var registry = {};
+
+ module.exports = {
+ getRegistry : function(){
+ return registry;
+ },
+ registerByType : function(type, instance, family){
+ var sup;
+ if(typeof registry[type] ==='undefined'){
+ registry[type] = {};
+ }
+ registry[type][instance.id] = instance;
+ if(sup = family.constructor.super){
+ if(sup._protoOf){
+ this.registerByType(sup._protoOf, instance, sup);
+ }
+ }
+ },
+ register : function(instance){
+ if(instance.id){
+ this.registerByType(instance._type, instance, instance);
+ }
+ },
+ getObjectById : function(id, type){
+ var result;
+ if(type){
+ result = registry[type][id];
+ if(!result){
+
+ }
+ }else{
+ result = registry['BaseObject'][id];
+ if(!result){
+
+ }
+ }
+ return result;
+ }
+ };
+});
+
+define('bases/BaseObject',['require','exports','module','common/util','common/string','bases/Registry'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ string = require('common/string'),
+ Registry = require('bases/Registry');
+
+ var _uid = 0;
+
+ var checkProperty = function(that, key){
+ if(!(key in that)){
+ throw new Error(key+' property does not exists');
+ }
+ }
+
+ var BaseObject = util.Class({
+ name : 'BaseObject',
+ extend : Object,
+ init : function(p){
+ util.defineProperty(this,'_uid',{value:++_uid});
+ if(typeof p === 'object'){
+ util.defineProperty(this,'id',{value:p.id || null});
+ Registry.register(this);
+ }
+ },
+ dynamics : {
+ get : function(key){
+ checkProperty(this, key);
+ var getter = 'get'+string.ucFirst(key);
+ if(this[getter]){
+ return this[getter]();
+ }else{
+ return this[key];
+ }
+ },
+ set : function(key, value){
+ checkProperty(this, key);
+ var setter = 'set'+string.ucFirst(key);
+ if(this[setter]){
+ this[setter](value);
+ }else{
+ this[key] = value;
+ }
+ },
+ setAssoc : function(key1, key2, value){
+ var obj = this.get(key1);
+ if(typeof obj!='object'){
+ throw new Error(key1+' property value is not object');
+ }
+ obj[key2] = value;
+ this.set(key1, obj);
+ }
+ },
+ statics : {
+ create : function(p){
+ return new this(p);
+ },
+ getType : function(){
+ return (new this())._type;
+ },
+ isEmpty : function(obj){
+ for(var prop in obj){
+ if(obj.hasOwnProperty(prop)){return false;}
+ }
+ return true;
+ }
+ }
+ });
+
+ module.exports = BaseObject;
+});
+
+define('common/dom',['require','exports','module','common/string'],function(require, exports, module) {
+
+ var string = require('common/string');
+
+ module.exports = {
+ byId : function(id){
+ return document.getElementById(id);
+ },
+ byTag : function(tagName){
+ return document.getElementsByTagName(tagName);
+ },
+ bySelector : function(selector, element){
+ element = element || document;
+ return element.querySelectorAll(selector);
+ },
+ getAppliedStyleClone : function(element){
+ var prop, result=new Object();
+ for(prop in element.style){
+ result[prop] = element.style[prop];
+ }
+ return result;
+ },
+ getComputedStyleClone : function(element){
+ var styles = window.getComputedStyle(element),
+ len = styles.length, i, prop,
+ result = {};
+ for(i=0; i<len; i++){
+ prop = styles[i];
+ //result[prop] = styles[prop];
+ result[prop] = styles.getPropertyValue(prop);
+ }
+ return result;
+ },
+ getComputedStyleDiff : function(styleOrg, styleVar){
+ var prop, result={};
+ for(prop in styleOrg){
+ if(styleOrg[prop]!=styleVar[prop]){
+ result[prop] = styleVar[prop];
+ }
+ }
+ return result;
+ },
+ checkComputedStyleDiff : function(styleOrg, styleVar){
+ var i, check=false, result = this.getComputedStyleDiff(styleOrg, styleVar);
+ for(i in result){
+ //
+ check=true;
+ }
+ return check;
+ },
+ getStyle : function(element, prop){
+ var styles = window.getComputedStyle(element);
+ //return styles[prop];
+ return styles.getPropertyValue(prop);
+ },
+ setStyles : function(element, propSet){
+ //
+ var prop, style=element.style;
+ for(prop in propSet){
+ style.setProperty(prop, propSet[prop]);
+ }
+ },
+ makeElement : function(tag, properties, where, win){
+ if(typeof win=='undefined') {win = window;}
+ var element = win.document.createElement(tag);
+ win.document.body.appendChild(element) ;
+ if(properties){
+ for (var p in properties) {
+ element[p] = properties[p] ;
+ }
+ }
+ if(where){
+ this.addElement(element, where.element, where.position) ;
+ }else{
+ win.document.body.appendChild(element) ;
+ }
+ return element;
+ },
+ /**
+ * @param {element} newElement
+ * @param {element} where
+ * @param {String} pos : 'before', 'after', 'inside'
+ */
+ addElement : function(newElement, where, pos){
+ if(pos=='after' || pos==undefined){
+ where.parentNode.insertBefore(newElement, where.nextSibling) ;
+ }else if(pos=='before'){
+ where.parentNode.insertBefore(newElement, where) ;
+ }else if(pos=='inside'){
+ where.appendChild(newElement);
+ //where.insertBefore(newElement, where.lastChild) ;
+ }
+ },
+ nodeType : {
+ 1 : 'ELEMENT_NODE',
+ 2 : 'ATTRIBUTE_NODE',
+ 3 : 'TEXT_NODE',
+ 4 : 'CDATA_SECTION_NODE',
+ 5 : 'ENTITY_REFERENCE_NODE',
+ 6 : 'ENTITY_NODE',
+ 7 : 'PROCESSING_INSTRUCTION_NODE',
+ 8 : 'COMMENT_NODE',
+ 9 : 'DOCUMENT_NODE',
+ 10 : 'DOCUMENT_TYPE_NODE',
+ 11 : 'DOCUMENT_FRAGMENT_NODE',
+ 12 : 'NOTATION_NODE'
+ },
+ prepareNode : function(){
+ if(typeof window.Node === 'undefined'){
+ for(i in this.nodeType){
+ window.Node[this.nodeType[i]] = i;
+ }
+ }
+ },
+ cloneNode : function(element, isRecursive){
+ var clone;
+ switch(element.nodeType){
+ //Now we just copy ELEMENT, TEXT NODE
+ case Node.ELEMENT_NODE :
+ //refer to element.attributes
+ //Now we just copy id and class to clone
+ //If you need more add it then.
+ clone = document.createElement(element.nodeName);
+ clone.id = element.id;
+ clone.className = element.className;
+ this.setStyles(clone, this.getComputedStyleClone(element));
+ break;
+ case Node.TEXT_NODE :
+ clone = document.createTextNode(element.nodeValue);
+ //if(string.trim(clone.nodeValue)){clone.nodeValue = 'c_'+clone.nodeValue;}
+ break;
+ default :
+ }
+ return clone;
+ },
+ shadowNode : function(element, isRecursive){
+ this.prepareNode();
+ //var clone = element.cloneNode(false);
+ var clone = this.cloneNode(element, false);
+ //var clone;
+ switch(element.nodeType){
+ case Node.ELEMENT_NODE :
+//
+ this.setStyles(clone, {visibility: 'hidden'});
+ if(clone.id){clone.id = 'clone_'+clone.id;} //TODO : selector case
+ if(element.hasChildNodes()){
+ var child;
+ for(child=element.firstChild; child != null; child = child.nextSibling){
+ clone.appendChild(this.shadowNode(child, isRecursive));
+ }
+ }
+ break;
+ case Node.TEXT_NODE :
+//
+ break;
+ default :
+
+ }
+ return clone;
+ },
+ cloneElement : function(element, position){
+
+ var i, childNode, nodeType;
+ var properties = {id:'clone_'+element.id};
+ var newElement = this.makeElement(element.nodeName, properties, {
+ element:element, position:position || 'after'
+ });
+ newElement.innerHTML = properties.id;
+ return newElement;
+ },
+ addEvent : function(element, eventName, eventHandler){
+ if(element.addEventListener){
+ element.addEventListener(eventName, eventHandler, false);
+ }else{
+ element.attachEvent('on'+eventName, eventHandler);
+ }
+ return eventHandler;
+ },
+ removeEvent : function(element, eventName, eventHandler){
+ if(element.addEventListener){
+ element.removeEventListener(eventName, eventHandler, false);
+ }else{
+ element.detachEvent('on'+eventName, eventHandler);
+ }
+ },
+ createEvent : function(eventName, data, bubbles, cancelable, noBundle) {
+ var oEvent = document.createEvent('Events');
+ oEvent.initEvent(eventName, bubbles, cancelable);
+ if(!noBundle){oEvent.bundle = {};}
+ if(data){
+ for(var i in data) {
+ if(data.hasOwnProperty(i)){
+ if(noBundle){
+ oEvent[i] = data[i];
+ }else{
+ oEvent.bundle[i] = data[i];
+ }
+ }
+ }
+ }
+ return oEvent;
+ },
+ dispatchEvent : function(element, eventName, data, bubbles, cancelable, noBundle){
+ var id = element.id ? ':'+element.id : '';
+ if(eventName != 'aniGroupTimeUpdate'){
+
+ }
+ if(element.fireEvent){
+ element.fireEvent('on'+eventName);
+ //TODO bundle
+ }else if(element.dispatchEvent){
+ element.dispatchEvent(this.createEvent(eventName, data, bubbles, cancelable, noBundle));
+ }
+ },
+ hide : function(id){
+ var element = this.byId(id);
+ if(element){
+ element.style.display = 'none';
+ }
+ },
+ /**
+ * @param {element} element
+ * @param {String} pos : 'Left', 'Top'
+ */
+ getAbsPos : function(element, pos){
+ var result = 0;
+ while(element.offsetParent){
+ result += element['offset'+pos];
+ element = element.offsetParent;
+ }
+ return result;
+ }
+ };
+
+});
+
+
+define('common/css',['require','exports','module','common/string'],function(require, exports, module) {
+
+ var string = require('common/string');
+
+ var css = {
+ propPrefix : 'webkit',
+ eventPrefix : 'webkit',
+ inlinePrefix : '-webkit-',
+ detectPrexfix : function(){
+
+ if(document.body){
+ var style = document.body.style;
+ if(style['webkitAnimation'] != undefined){
+ this.propPrefix = 'webkit';
+ this.eventPrefix = 'webkit';
+ this.inlinePrefix = '-webkit-';
+ }else if(style['MozAnimation'] != undefined){
+ this.propPrefix = 'Moz';
+ this.eventPrefix = '';
+ this.inlinePrefix = '';
+ }else if(style['animation'] != undefined){
+ this.propPrefix = '';
+ this.eventPrefix = '';
+ this.inlinePrefix = '';
+ }
+ }
+
+
+ },
+ fixProp : function(prop){
+ if(this.propPrefix){
+ prop = this.propPrefix+string.ucFirst(prop);
+ }
+ return prop;
+ },
+ fixInline : function(prop){
+ if(this.inlinePrefix){
+ prop = this.inlinePrefix+prop;
+ }
+ return prop;
+ },
+ fixEvent : function(eventName){
+ if(this.eventPrefix){
+ eventName = this.eventPrefix+string.ucFirst(eventName);
+ }else{
+ eventName = eventName.toLowerCase();
+ }
+ return eventName;
+ },
+ insertRule : function(styleSheet, selector, cssDesc, pos){
+
+ if(styleSheet.insertRule){
+ styleSheet.insertRule(selector+'{'+cssDesc+'}',pos);
+ }else if(styleSheet.addRule){
+ styleSheet.addRule(selector,cssDesc,pos);
+ }else{
+ throw new Error('insertRule() not supported');
+ }
+ },
+ setAnimation : function(element, prop){
+
+ element.style[this.fixProp('animationName')] = prop.name;
+ element.style[this.fixProp('animationDelay')] = prop.delay;
+ element.style[this.fixProp('animationFillMode')] = prop.fillmode;
+ element.style[this.fixProp('animationDuration')] = prop.duration;
+ element.style[this.fixProp('animationDirection')] = prop.direction;
+ element.style[this.fixProp('animationTimingFunction')] = prop.timing;
+ element.style[this.fixProp('animationIterationCount')] = prop.iteration;
+ element.style[this.fixProp('animationPlayState')] = 'running';
+
+ //
+ },
+ resetAnimation1 : function(element){
+
+ try{
+ delete element.style[this.fixProp('animation')];
+ delete element.style[this.fixProp('animationName')];
+ delete element.style[this.fixProp('animationDelay')];
+ delete element.style[this.fixProp('animationFillMode')];
+ delete element.style[this.fixProp('animationDuration')];
+ delete element.style[this.fixProp('animationDirection')];
+ delete element.style[this.fixProp('animationTimingFunction')];
+ delete element.style[this.fixProp('animationIterationCount')];
+ //delete element.style[this.fixProp('animationPlayState')];
+ }catch(e){
+
+ }
+ },
+ resetAnimation : function(element){
+
+ var style = element.style;
+ try{
+ delete style[this.fixProp('animation')];
+ delete style[this.fixProp('animationName')];
+ delete style[this.fixProp('animationDelay')];
+ delete style[this.fixProp('animationFillMode')];
+ delete style[this.fixProp('animationDuration')];
+ delete style[this.fixProp('animationDirection')];
+ delete style[this.fixProp('animationTimingFunction')];
+ delete style[this.fixProp('animationIterationCount')];
+ style[this.fixProp('animation')] = '';
+ style[this.fixProp('animationName')] = '';
+ style[this.fixProp('animationDelay')] = '';
+ style[this.fixProp('animationFillMode')] = '';
+ style[this.fixProp('animationDuration')] = '';
+ style[this.fixProp('animationDirection')] = '';
+ style[this.fixProp('animationTimingFunction')] = '';
+ style[this.fixProp('animationIterationCount')] = '';
+ style[this.fixProp('animationPlayState')] = '';
+ }catch(e){
+
+ }
+ }
+ };
+
+ css.detectPrexfix();
+
+ module.exports = css;
+
+});
+
+
+define('common/env',['require','exports','module','common/css'],function(require, exports, module) {
+
+ var css = require('common/css');
+
+ module.exports = {
+ agent : null,
+ useJQuery : false,
+ init : function(p){
+
+ this.detectAgent();
+ this.setJQuery(p.useJQuery);
+ },
+ setJQuery : function(useJQuery){
+ if(typeof jQuery !='undefined' && useJQuery){
+ this.useJQuery = true;
+ }
+ },
+ detectAgent : function(){
+
+ var userAgent = window.navigator.userAgent;
+
+ if((/ Qt/ig).test(userAgent)){
+ this.agent = 'qt';
+ }else if((/ OPR/ig).test(userAgent)){
+ this.agent = 'opera';
+ }else if((/ Chrome/ig).test(userAgent)){
+ this.agent = 'chrome';
+ }else if((/ Safari/ig).test(userAgent)){
+ this.agent = 'safari';
+ }else if((/ Firefox/ig).test(userAgent)){
+ this.agent = 'firefox';
+ }else if((/ MSIE/ig).test(userAgent)){
+ this.agent = 'ie';
+ }
+
+ }
+ };
+});
+
+
+define('events/Event',['require','exports','module','common/util','common/env','common/dom','bases/Registry','bases/BaseObject'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ env = require('common/env'),
+ dom = require('common/dom'),
+ Registry = require('bases/Registry'),
+ BaseObject = require('bases/BaseObject');
+
+ var Event = util.Class({
+ name : 'Event',
+ extend : BaseObject,
+ init : function(p){
+ Event.super.init.apply(this, arguments);
+ },
+ dynamics : {
+ },
+ statics : {
+ create : function(p){
+//
+//
+//
+//
+ if(env.useJQuery){
+ //
+ }else{
+ dom.addEvent(p.element, p.eventName, function(oEvent){
+
+ //TODO : How can we control cases
+ if(p.type==='AniGroup'){
+ var aniGroup = Registry.getObjectById(p.target, 'AniGroup');
+ aniGroup[p.act]();
+ }
+ });
+ }
+
+ return new this(p);
+ }
+ }
+ });
+
+ module.exports = Event;
+});
+
+define('dom/Dom',['require','exports','module','common/util','common/dom','common/string','bases/BaseObject','events/Event'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ dom = require('common/dom'),
+ string = require('common/string'),
+ BaseObject = require('bases/BaseObject'),
+ Event = require('events/Event');
+
+ var Dom = util.Class({
+ name : 'Dom',
+ extend : BaseObject,
+ init : function(p, element){
+ Dom.super.init.apply(this, arguments);
+ this.set('element', element);
+ this.set('style', this.element.style);
+ this.set('events', new Object());
+
+ if(p.events){
+ //
+ var eventName, eventSet, i;
+ for(eventName in p.events){
+ if(!this.events[eventName]){
+ this.events[eventName] = new Array();
+ }
+ eventSet = p.events[eventName];
+ for(i=0; i<eventSet.length; i++){
+ this.events[eventName].push(Event.create({
+ id : eventSet[i].id,
+ element : this.element,
+ eventName : eventName,
+ type : eventSet[i].type,
+ target : eventSet[i].target,
+ act : eventSet[i].act
+ }));
+ }
+ }
+ }
+ },
+ dynamics : {
+ style : null,
+ element : null,
+ events : null
+ },
+ statics : {
+ create : function(p){
+ if(typeof p.element === 'object'){
+ return new this(p, p.element);
+ }else if(p.id && dom.byId(p.id)){
+ var oid = p.id;
+ var i, r=new Object();
+ for(i in p){
+ r[i] = p[i];
+ }
+ r.id = 'dom'+string.ucFirst(r.id);
+ return new this(r, dom.byId(oid));
+ }
+ }
+ }
+ });
+
+ module.exports = Dom;
+});
+
+define('nodes/Node',['require','exports','module','common/util','common/dom','bases/BaseObject','dom/Dom'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ dom = require('common/dom'),
+ BaseObject = require('bases/BaseObject'),
+ Dom = require('dom/Dom');
+
+ var Node = util.Class({
+ name : 'Node',
+ extend : BaseObject,
+ init : function(p){
+ Node.super.init.apply(this, arguments);
+ this.set('children', new Array());
+ this.set('dom', Dom.create(p));
+ },
+ dynamics : {
+ parent : null,
+ children : null,
+ dom : null,
+ visible : true,
+ addChild : function(child){
+ this.children.push(child);
+ child.set('parent', this);
+ return this;
+ },
+ hasChildren : function(){
+ return this.children.length > 0;
+ },
+ hasParent : function(){
+ return (this.parent instanceof this.constructor);
+ },
+ getChildById : function(id){
+ var i;
+ for(i in this.children){
+ if(this.children[i]['id']===id){
+ return this.children[i];
+ }
+ }
+ },
+ runAction : function(action){
+ //TODO : ActionManager.add(action, this);
+ action.runWith(this);
+ },
+ pauseAction : function(action){
+ action.pauseWith(this);
+ },
+ resumeAction : function(action){
+ action.resumeWith(this);
+ },
+ stopAction : function(action){
+ //TODO : ActionManager.remove(action, this);
+ action.stopWith(this);
+ },
+ setVisible : function(isVisible){
+ this.visible = isVisible;
+ if(this.dom){
+ var style = this.dom.style;
+ style.visibility = isVisible ? 'visible' : 'hidden';
+ }
+ },
+ show : function(){
+ if(this.dom){
+ var style = this.dom.style;
+ style.display = 'block';
+ }
+ },
+ hide : function(){
+ if(this.dom){
+ var style = this.dom.style;
+ style.display = 'none';
+ }
+ }
+ },
+ statics : {
+ }
+ });
+
+ module.exports = Node;
+});
+
+define('common/logger',['require','exports','module'],function(require, exports, module) {
+
+ module.exports = {
+ log : function(){
+
+ },
+ event : function(str){
+ this.log('%c ====> '+str+'\r\n', 'color:#4CC552');
+ },
+ check : function(obj, name){
+ var result='';
+ if(!name){name = '';}else{name = name+'.';}
+ for(var p in obj){
+ result += '\t'+name+p+' = '+obj[p]+'\n';
+ }
+ //return result;
+ }
+ }
+
+});
+
+
+define('bases/Timer',['require','exports','module'],function(require, exports, module) {
+
+ var uid=0, timers={};
+
+ module.exports = {
+ getTimer : function(uid){
+ return timers[uid];
+ },
+ repeat : function(p){
+ var onRepeat = p.onRepeat || function(){},
+ duration = p.duration || 1000,
+ iteration = p.iteration || 1,
+ immediately = p.immediately || true,
+ onEnd = p.onEnd || function(){},
+ bundle = p.bundle || {};
+ var timer = timers[++uid] = {
+ id : null,
+ type : 'repeat',
+ duration : duration,
+ iteration : iteration,
+ step : 0,
+ paused : false,
+ startMs : 0,
+ progress : 0,
+ bundle : bundle,
+ onRepeat : onRepeat,
+ onEnd : onEnd
+ };
+ if(immediately){
+ ++timer.step;
+ timer.startMs = (new Date()).getTime();
+ onRepeat(bundle);
+ }
+ timer['id'] = setInterval(function(bundle){
+ if(++timer.step <= timer['iteration']){
+ timer.startMs = (new Date()).getTime();
+ onRepeat(bundle);
+ }else{
+ onEnd(bundle);
+ clearInterval(timer['id']);
+ }
+ },timer['duration'],bundle);
+ return uid;
+ },
+ setInterval : function(func, msec){
+ timers[++uid] = {
+ type : 'interval',
+ id : setInterval(func, msec)
+ };
+ return uid;
+ },
+ setTimeout : function(func, msec){
+ timers[++uid] = {
+ type : 'interval',
+ id : setTimeout(func, msec)
+ };
+ return uid;
+ },
+ pause : function(u){
+ var timer = timers[u],
+ type = timer['type'];
+ switch(type){
+ case 'interval' :
+ //TODO
+ break;
+ case 'timeout' :
+ //TODO
+ break;
+ case 'repeat' :
+ var elapsed = (new Date()).getTime()-timer['startMs'];
+ timer['progress'] = elapsed/timer['duration'];
+ timer['paused'] = true;
+ clearInterval(timer['id']);
+ clearInterval(timer['timeout']);
+ break;
+ }
+ },
+ resume : function(u, callback){
+ var timer = timers[u],
+ type = timer['type'];
+ switch(type){
+ case 'interval' :
+ //TODO
+ break;
+ case 'timeout' :
+ //TODO
+ break;
+ case 'repeat' :
+ timer.paused = false;
+
+
+ //남은 시간동안 진행한다
+
+ callback();
+
+ ++timer.step;
+
+ var ms = (1-timer['progress'])*timer['duration'];
+
+ timer['timeout'] = setTimeout(function(timer){
+
+ var onRepeat = timer.onRepeat;
+ var onEnd = timer.onEnd;
+ var bundle = timer.bundle;
+
+ timer.startMs = (new Date()).getTime();
+ onRepeat(bundle);
+
+ timer['id'] = setInterval(function(bundle){
+ if(++timer.step <= timer['iteration']){
+ timer.startMs = (new Date()).getTime();
+ onRepeat(bundle);
+ }else{
+ onEnd(bundle);
+ clearInterval(timer['id']);
+ }
+ },timer['duration'],bundle);
+
+ },ms,timer);
+
+ break;
+ }
+ },
+ clear : function(u){
+ var timer = timers[u],
+ type = timer['type'];
+ switch(type){
+ case 'interval' :
+ clearInterval(timer['id']);
+ break;
+ case 'timeout' :
+ clearTimeout(timer['id']);
+ break;
+ case 'repeat' :
+ clearInterval(timer['id']);
+ break;
+ }
+ },
+ sleep : function(delay) {
+ var start = new Date().getTime();
+ while (new Date().getTime() < start + delay){;}
+ }
+ };
+});
+
+define('actions/Action',['require','exports','module','common/util','bases/BaseObject'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ BaseObject = require('bases/BaseObject');
+
+ var Action = util.Class({
+ name : 'Action',
+ extend : BaseObject,
+ init : function(p){
+ Action.super.init.apply(this, arguments);
+ },
+ dynamics : {
+ target : null,
+ state : 'stop',
+ runWith : function(node){
+ this.set('target',node);
+ this.set('state','run');
+ },
+ pauseWith : function(node){
+ if(this.get('state')==='run'){
+ this.set('state','pause');
+ }
+ },
+ resumeWith : function(node){
+ if(this.get('state')==='pause'){
+ this.set('state','run');
+ }
+ },
+ stopWith : function(node){
+ this.set('target',null);
+ this.set('state','stop');
+ }
+ },
+ statics : {
+ }
+ });
+
+ module.exports = Action;
+});
+/*
+[2013-09-26 Thu]
+setTimeWith() : negative msec problem solved.
+
+[2013-09-26 Thu]
+setTimeWith() : set delta as 0.1 to avoid over time blinking issue (QT bug)
+
+[2013-11-08 Fri]
+1. QT 에서 끝으로 튀는 경우를 막아야 함 (detect endCss 시도해 볼 필요 있음)
+
+유정욱(선임/에스코어) [오후 10:36]:
+ 수석님 여기 적어놓을게요
+심흥운(수석보/에스코어) [오후 10:36]:
+ 넵
+유정욱(선임/에스코어) [오후 10:36]:
+ animation 재생되는거랑
+ setCurrent 가
+ 다른 상황을 찾았는데요
+ css 가 이래요
+ @-webkit-keyframes TizenSelector3 {
+ 0.0% {
+ }
+ 100.0% {
+ -webkit-transform:translate(0px, 0px) rotate(720deg);
+ left:232px;
+ top:270px;
+ }
+}
+심흥운(수석보/에스코어) [오후 10:38]:
+ 넵
+유정욱(선임/에스코어) [오후 10:38]:
+ 증상은 재생될때는 그냥 이동만 하고요
+ setCurrent 할 때는 rotate 가 먹으면서 되고요
+심흥운(수석보/에스코어) [오후 10:40]:
+ 음...
+ 뭐지...
+ 이걸로 테스트 하면서 살펴볼게요
+
+
+withNode 방식을 Node setter로
+
+*
+* * */
+
+define('actions/Animate',['require','exports','module','common/util','common/env','common/logger','common/string','common/dom','common/css','bases/Registry','actions/Action'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ env = require('common/env'),
+ logger = require('common/logger'),
+ string = require('common/string'),
+ dom = require('common/dom'),
+ css = require('common/css'),
+ Registry = require('bases/Registry'),
+ Action = require('actions/Action');
+
+ var subLen = 10;
+ if(css.inlinePrefix.length){
+ subLen = 10 + css.inlinePrefix.length;
+ }
+
+
+ var Animate = util.Class({
+ name : 'Animate',
+ extend : Action,
+ init : function(p){
+ Animate.super.init.apply(this, arguments);
+ this.set('delay', p.delay || '0s');
+ this.set('duration', p.duration || '0s');
+ this.set('iteration', p.iteration || 1);
+ if(this.iteration==='infinite'){
+ this.iteration = Number.MAX_VALUE/10000000;
+ }
+ this.set('direction', p.direction || 'normal');
+ this.set('fillmode', p.fillmode || 'forwards');
+ this.set('timing', p.timing || 'ease');
+ if(p.justplay===true){
+ this.set('justplay', true);
+ }else{
+ this.set('justplay', false);
+ }
+ this.set('holdEnd', p.holdEnd || false);
+ this.set('handlers', {
+ start : function(){},
+ iteration : function(){},
+ end : function(){},
+ resumeTime : function(){}
+ });
+ if(p.handlers){
+ if(typeof p.handlers.start==='function'){
+ this.setAssoc('handlers','start',p.handlers.start);
+ }
+ if(typeof p.handlers.iteration==='function'){
+ this.setAssoc('handlers','iteration',p.handlers.iteration);
+ }
+ if(typeof p.handlers.end==='function'){
+ this.setAssoc('handlers','end',p.handlers.end);
+ }
+ if(typeof p.handlers.resumeTime==='function'){
+ this.setAssoc('handlers','resumeTime',p.handlers.resumeTime);
+ }
+ }
+ this.set('delayRemain', parseFloat(this.delay)*1000);
+ this.set('totalDuration', parseFloat(this.duration)*this.iteration*1000);
+ this.set('currentTime', -1*this.delayRemain);
+ },
+ dynamics : {
+ delay : null,
+ duration : null,
+ iteration : null,
+ direction : null,
+ fillmode : null,
+ timing : null,
+ justplay : null,
+ handlers : null,
+ holdEnd : null,
+ iterated : 0,
+ beforeCss : null,
+ originCss : null,
+ startCss : null,
+ endCss : null,
+ startMs : 0,
+ delayRemain : null, //Check the animation is in a running state or not (To process delayed animations)
+ currentTime : 0,
+ timelineState : 0,
+ totalDuration : 0,
+ noMove : false,
+ bindAnimation : function(element, prop){
+
+ prop.name = prop.id;
+ css.setAnimation(element, prop);
+ this.updateStartMs();
+ },
+ unbindAnimation : function(){
+
+ if(this.target){
+ var element = this.target.dom.element;
+ css.resetAnimation(element);
+ var clone = dom.byId('clone_'+element.id);
+ if(clone){css.resetAnimation(clone);}
+ }
+ },
+ updateStartMs : function(){
+ this.set('startMs', (new Date()).getTime());
+ },
+ runWithDelay : function(element, delayMs){
+
+ this.bindAnimation(element, {
+ id : this.id,
+ delay : (delayMs/1000)+'s',
+ fillmode : this.fillmode,
+ duration : this.duration,
+ direction : this.direction,
+ timing : this.timing,
+ iteration : this.iteration,
+ playState : 'running'
+ });
+ },
+ setStartPos : function(node){
+
+ if(this.endCss){
+ this.beforeCss = this.endCss;
+ }
+ if(this.startCss){
+ this.setStyleByDiff(node.dom.element, this.startCss);
+ }
+ },
+ runWith : function(node){
+ //this.target HOW? TODO:
+
+
+ //set start state
+ this.setStartPos(node);
+
+ //unbind if exists and reset conditional vars
+ this.unbindAnimation();
+ this.resetStates();
+
+
+
+ //
+ //
+ if(this.target && this.target._uid===node._uid){
+ this.stopWith(this.target);
+ }
+ setTimeout(function(that, args, node){
+ Animate.super.runWith.apply(that, args);
+ that.bindAnimation(node.dom.element, that);
+ },1,this,arguments,node);
+
+ },
+ pauseWith : function(node){
+
+ var style = node.dom.style;
+ //
+ if(style[css.fixProp('animationName')] && this.state==='run'){
+ Animate.super.pauseWith.apply(this, arguments);
+
+ //delayed and before run
+ if(this.delayRemain > 0){
+ var delta = (new Date()).getTime() - this.startMs; //played time
+ this.set('delayRemain', this.delayRemain - delta);
+
+
+ }
+
+ //not yet run
+ if(this.delayRemain > 0){
+ var log = ' @@ delayed : this.id = '+this.id+', ';
+ log += 'this.target.id = '+this.target.id+", ";
+ log += "style[css.fixProp('animationDelay')] = "+style[css.fixProp('animationDelay')];
+
+ this.unbindAnimation();
+ //in run state
+ }else{
+ style[css.fixProp('animationPlayState')] = 'paused';
+ }
+ }
+ },
+ resumeWith : function(node){
+
+ var style = node.dom.style;
+ this.set('timelineState', 0);
+ if(style[css.fixProp('animationName')] && this.state==='pause'){
+ Animate.super.resumeWith.apply(this, arguments);
+ style[css.fixProp('animationPlayState')] = 'running';
+ }
+ //delayed before run
+ if(this.delayRemain > 0 && this.state==='pause'){
+
+ Animate.super.resumeWith.apply(this, arguments);
+ //
+ this.runWithDelay(node.dom.element, this.delayRemain);
+ }
+ },
+ resetStates : function(){
+
+ this.set('startMs', 0);
+ this.set('timelineState', 0);
+ this.set('iterated', 0);
+ this.set('delayRemain', parseFloat(this.delay)*1000); //init again
+ this.set('currentTime', -1*this.delayRemain);
+ },
+ stopWith : function(node){
+
+ //to hold end state
+
+ if(this.holdEnd===true && this.target){
+ this.detectEndCss();
+ this.beforeCss = this.startCss;
+ this.setStyleByDiff(this.target.dom.element, this.endCss, true);
+ }
+ this.unbindAnimation();
+ this.resetStates();
+ Animate.super.stopWith.apply(this, arguments);
+ },
+ detectStyleWith : function(node){
+
+ this.detectOriginCss(node);
+ setTimeout(function(that,node){
+ that.detectStartCss(node);
+ },1,this,node);
+ },
+ detectOriginCss : function(node){
+
+ var element = node.dom.element;
+ var originCss = Animate.getCloneStyle(element);
+ this.set('originCss', originCss);
+
+
+ },
+ detectStartCss_old : function(node){
+
+ var element = node.dom.element;
+ var clone = dom.byId('clone_'+element.id);
+ this.set("timelineState", Animate.IS_DETECT_START);
+ this.set("target", node);
+ this.runWithDelay(clone, 0);
+ },
+ detectStartCss : function(node){
+
+ var element = node.dom.element;
+ var clone = dom.byId('clone_'+element.id);
+
+//
+//
+
+ //Bind with pause
+ this.bindAnimation(clone, {
+ id : this.id,
+ delay : '0s',
+ fillmode : this.fillmode,
+ duration : this.duration,
+ direction : this.direction,
+ timing : this.timing,
+ iteration : this.iteration,
+ playState : 'pause'
+ });
+
+ //startStyle
+ var startCss = Animate.getCloneStyle(clone);
+ this.set('startCss', startCss);
+ //
+
+
+
+ //add new styles of startCss to origin
+/*
+ for(var p in startCss){
+ if(typeof this.originCss[p] === 'undefined'){
+ this.originCss[p] = startCss[p];
+ }
+ }
+*/
+//
+//
+ //
+ //
+
+ setTimeout(function(clone,node,animate){
+ //Reset Animation
+ css.resetAnimation(clone);
+ //fire onSetTime event
+ dom.dispatchEvent(node.dom.element,
+ Animate.DETECT_START_CSS, {
+ animate : animate,
+ node : node
+ },true,true);
+
+ },0,clone,node,this);
+ },
+ detectEndCss : function(){
+
+ if(this.target!=null){
+ this.set('endCss', Animate.getCloneStyle(this.target.dom.element));
+
+
+ }
+ },
+ setStyleByDiff : function(element, style, isLog){
+
+ if(this.beforeCss==null){
+ this.beforeCss = this.originCss;
+ }
+
+ var diff = dom.getComputedStyleDiff(this.beforeCss, style);
+ if(isLog){}
+ //if(1){}
+ dom.setStyles(element, diff);
+
+ this.beforeCss = style;
+
+ //fire onSetTime event
+ Animate.dispatchSetTimeEvent(
+ element,
+ '#'+element.id, //TODO modify to Selector
+ this.currentTime,
+ this);
+ },
+ goToStartFrameWith : function(node){
+
+ var element = node.dom.element;
+ this.stopWith(node); //reset all
+ this.setStyleByDiff(element, this.startCss);
+ },
+ resumeTimeWith : function(node){
+
+ this.set('timelineState', Animate.IS_RESUME_TIME);
+ this.set('state', 'run');
+ this.set('target', node);
+ this.runWithDelay(node.dom.element, -1*this.currentTime);
+ //resume position is -1*this.currentTime
+ //2013.09.17 until now here
+ //TODO : run() then setCurrentTime(), Eliminate aniImage2ing
+ //Refer to prototyping html of setCurrentTime
+ },
+ update : function(durationMs, delayMs){
+
+
+ if(typeof delayMs != 'undefined'){
+ var delayDelta = delayMs - parseFloat(this.delay)*1000;
+ var delayRemain = this.delayRemain + delayDelta;
+
+ if(delayRemain < 0){
+
+ delayRemain = 0;
+ }
+ this.set('delay', (delayMs/1000)+'s');
+ this.set('delayRemain', delayRemain);
+ this.set('currentTime', this.currentTime - delayDelta);
+
+ }
+
+ if(typeof durationMs != 'undefined'){
+ this.set('duration', (durationMs/1000)+'s');
+ this.set('totalDuration', durationMs*this.iteration);
+ this.set('iterated', Math.floor(this.currentTime/durationMs));
+ }
+
+ },
+ setTimeWith : function(node, msec, ignoreDelta){
+
+
+
+
+ if(parseFloat(this.duration)==0){
+
+
+ return;
+ }
+ var element = node.dom.element;
+ var delta = Math.abs(this.currentTime - msec);
+
+
+
+ var actualPos = parseFloat(this.delay)*1000 + msec;
+
+
+ //start position
+ if(actualPos==0){
+ this.unbindAnimation();
+ this.resetStates();
+ }else{
+ //pass under 0.1ms
+ if(delta <= 0.5 && !ignoreDelta){
+
+ return;
+ }
+ }
+
+ this.set('currentTime', msec);
+ this.set('timelineState', Animate.IS_SET_TIME);
+ if(msec < this.totalDuration){
+ this.set('state', 'pause');
+ }else{
+ this.set('state', 'stop');
+ }
+
+ // 0. origin running state
+ if(element.style[css.fixProp('animationPlayState')]==='running'){
+ this.unbindAnimation();
+ element.style.visibility = 'hidden'; //hide temporally
+ }
+
+ // 1. Clone
+ var clone = dom.byId('clone_'+element.id);
+
+ // + avoid overlap of running
+ if( clone.style[css.fixProp('animationName')]!='none' &&
+ clone.style[css.fixProp('animationPlayState')]==='running'){
+
+
+
+ //QT BUG FIX
+ if(env.agent==='qt'){
+ setTimeout(function(clone){
+ css.resetAnimation(clone);
+ },1,clone);
+ }else{
+ css.resetAnimation(clone);
+ }
+ }
+
+ // + paused state
+ if( element.style[css.fixProp('animationName')]!=='' &&
+ element.style[css.fixProp('animationPlayState')]==='paused'){
+
+ this.unbindAnimation();
+ }
+
+ var durationMs = parseFloat(this.get('duration'))*1000,
+ iterated;
+
+ //Normal Case
+ if(msec >= 0){
+
+ this.set('delayRemain', 0);
+ this.set('iterated', Math.floor(msec/durationMs));
+
+ //if msec is negative then the animation will have delay.
+ //before play (msec < delay) (Not yet played)
+ }else{
+ this.set('delayRemain', -1*msec);
+ this.set('iterated', 0);
+ msec = 0;
+ }
+
+
+
+
+ // 2.move clone
+ this.runWithDelay(clone, -1*msec);
+ this.set('target', node);
+ }
+ },
+ statics : {
+ IS_SET_TIME : 1,
+ IS_RESUME_TIME : 2,
+ IS_DETECT_START : 3,
+ IS_GET_CSS : 4,
+ DETECT_START_CSS : 'detectStartCss',
+ SET_TIME : 'setTime',
+ eventLog : function(animate, oEvent, eventState){
+ if(!animate.target){return;}
+
+ var timelineState = {
+ 0 : 'IS_NORMAL',
+ 1 : 'IS_SET_TIME',
+ 2 : 'IS_RESUME_TIME',
+ 3 : 'IS_DETECT_START'
+ };
+ logger.event(oEvent.animationName+' -> '+oEvent.target.id +' > '+eventState+', timelineState='+timelineState[animate.timelineState]);
+ },
+ dispatchSetTimeEvent : function(element, selector, currentTime, animate){
+ dom.dispatchEvent(element,
+ Animate.SET_TIME, {
+ selector : selector,
+ currentTime : currentTime,
+ css : dom.getComputedStyleClone(element),
+ animate : animate
+ },true,true);
+ },
+ addAniEvent : function(){
+
+ dom.addEvent(document, css.fixEvent('animationStart'), function(oEvent){
+
+
+
+ var animate = Registry.getObjectById(oEvent.animationName, 'Animate');
+ if(typeof animate === 'undefined'){return;}
+
+ var node = animate.target;
+ if(!node){return;}
+ var element = node.dom.element;
+ var clone = dom.byId('clone_'+element.id);
+ Animate.eventLog(animate, oEvent, 'Start');
+
+ //reset above <0. origin running state>
+ if(node.visible===true){
+ element.style['visibility'] = 'visible';
+ }
+
+ //setTimeWith
+ if(animate.timelineState===Animate.IS_SET_TIME){
+
+ clone.style[css.fixProp('animationPlayState')] = 'paused';
+ var movedStyle = Animate.getCloneStyle(clone);
+
+ //TODO : check wheather things changed
+ var ch = dom.checkComputedStyleDiff(animate.originCss, movedStyle);
+// var ch = true;
+// if((animate.startCss.top === movedStyle.top)){
+// ch=false;
+// }
+ if(animate.currentTime > 0 && ch===false){
+
+ }else{
+
+ /*
+ if(animate.startCss[css.fixInline('transform')] === movedStyle[css.fixInline('transform')){
+
+
+
+
+
+
+
+
+ }
+ */
+
+ //in a delay condition then apply startCss
+ if(animate.currentTime <= 0){
+ animate.setStyleByDiff(element, animate.startCss);
+ //apply new style to original
+ }else{
+ animate.setStyleByDiff(element, movedStyle);
+ }
+ }
+
+ //Reset Animation
+ css.resetAnimation(clone);
+ animate.set('target',null);
+
+ //IS_DETECT_START
+ }else if(animate.timelineState===Animate.IS_DETECT_START){
+
+ animate.set("startCss", Animate.getCloneStyle(clone));
+
+
+
+ setTimeout(function(animate) {
+ css.resetAnimation(animate);
+ animate.set("target", null);
+ }, 1, animate);
+ animate.set("timelineState", 0);
+ dom.dispatchEvent(element, Animate.DETECT_START_CSS, {
+ animate : animate,
+ node : node
+ }, true, true);
+
+ //resumeTimeWith
+ }else if(animate.timelineState===Animate.IS_RESUME_TIME){
+
+ animate.set('timelineState',0);
+ animate.handlers.resumeTime(animate);
+
+ //Normal
+ }else{
+ animate.handlers.start(animate);
+ }
+ });
+ dom.addEvent(document, css.fixEvent('animationIteration'), function(oEvent){
+ var animate = Registry.getObjectById(oEvent.animationName, 'Animate');
+ if(typeof animate === 'undefined'){return;}
+ Animate.eventLog(animate, oEvent, 'Iteration');
+ animate.handlers.iteration(animate);
+ animate.set('iterated',animate.get('iterated')+1);
+ });
+ dom.addEvent(document, css.fixEvent('animationEnd'), function(oEvent){
+ var animate = Registry.getObjectById(oEvent.animationName, 'Animate');
+ if(typeof animate === 'undefined'){return;}
+ Animate.eventLog(animate, oEvent, 'End');
+
+ //prevent stop event when setTime() is called.
+ if(animate.timelineState != Animate.IS_SET_TIME){
+ animate.handlers.end(animate);
+ }
+
+ //detect end css
+ //animate.detectEndCss();
+
+ animate.set('state','stop');
+ animate.set('timelineState',0);
+
+
+
+ });
+ },
+ getCloneStyle : function(element){
+
+ var i, prop, result={},
+ styles = window.getComputedStyle(element);
+
+ for(i=0; i<styles.length; i++){
+ prop = styles[i];
+ if(prop.substr(0,subLen)!==css.fixInline('animation-') && prop !== 'visibility'){
+ //
+ //result[prop] = styles[prop];
+ result[prop] = styles.getPropertyValue(prop);
+ }
+ }
+ //compensation
+ /*
+ if(typeof result['opacity']==='string'){
+ var d = Math.abs(1-parseFloat(result['opacity']));
+ //assume over 0.98 is 1
+ if(d < 0.02){
+ result['opacity'] = 1;
+ }
+ }
+ */
+ if(typeof result[css.fixInline('transform')]==='string'){
+ if(result[css.fixInline('transform')]==='matrix(1, 0, 0, 1, 0, 0)'){
+ result[css.fixInline('transform')] = 'none';
+ }
+ }
+ //QT Bug
+ if(env.agent==='qt'){
+ if(result['clip'] == 'rect(0px 0px 0px 0px)'){
+ result['clip'] = 'auto';
+ }
+ }
+ //WebKit Bug
+ result['kerning'] = parseInt(result['kerning'])+'px';
+ result['stroke-dashoffset'] = parseInt(result['stroke-dashoffset'])+'px';
+ result['stroke-width'] = parseInt(result['stroke-width'])+'px';
+ //Fix
+ if(result['z-index']==='auto'){
+ result['z-index'] = '0';
+ }
+ return result;
+ }
+ }
+ });
+
+ //move to start pos
+ dom.addEvent(document, Animate.DETECT_START_CSS, function(oEvent){
+ logger.event(Animate.DETECT_START_CSS);
+ var node = oEvent.bundle.node,
+ animate = oEvent.bundle.animate;
+ animate.goToStartFrameWith(node);
+ });
+
+ Animate.addAniEvent();
+
+ module.exports = Animate;
+});
+
+define('nodes/Scene',['require','exports','module','common/util','common/dom','bases/BaseObject','bases/Registry','bases/Timer','nodes/Node','actions/Animate'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ dom = require('common/dom'),
+ BaseObject = require('bases/BaseObject'),
+ Registry = require('bases/Registry'),
+ Timer = require('bases/Timer'),
+ Node = require('nodes/Node'),
+ Animate = require('actions/Animate');
+
+ var Scene = util.Class({
+ name : 'Scene',
+ extend : Node,
+ init : function(p){
+ Scene.super.init.apply(this, arguments);
+ this.transit = p.transit || '';
+ },
+ dynamics : {
+ transit : null,
+ addLayer : function(layer){
+ this.addChild(layer);
+ },
+ play : function(){
+
+ },
+ stop : function(){
+
+ /*
+ TODO : for(i in this.children){
+ It's ambiguos what to stop (?)
+ layers ? shapes of layers ?
+ what about flash ? tell target stop
+ }
+ */
+ },
+ clone : function(){
+
+ var top = '0px', left = '0px',
+ element = this.dom.element,
+ clone = dom.shadowNode(element, true),
+ zIndex = dom.getStyle(element,'zIndex'),
+ position = dom.getStyle(element,'position');
+
+ if(isNaN(parseInt(zIndex))){
+ zIndex = -1;
+ }else{
+ zIndex = zIndex - 1;
+ }
+ if(position=='absolute'){
+ top = dom.getAbsPos(element, 'Top')+'px';
+ left = dom.getAbsPos(element, 'Left')+'px';
+ }
+ dom.setStyles(clone, {
+ backgroundColor: 'red',
+ position:'absolute',
+ zIndex:zIndex,
+ top:top,
+ left:left,
+ });
+ dom.addElement(clone, element, 'after') ;
+ //element.style.opacity = 0.5;
+ /*
+ dom.dispatchEvent(element,
+ Scene.CLONE_READY, {
+ scene : this
+ },true,true);
+ */
+ }
+ },
+ statics : {
+ CLONE_READY : 'cloneReady'
+ }
+ });
+
+ module.exports = Scene;
+});
+
+define('nodes/shapes/Shape',['require','exports','module','common/util','nodes/Node'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ Node = require('nodes/Node');
+
+ var Shape = util.Class({
+ name : 'Shape',
+ extend : Node,
+ init : function(p){
+ Shape.super.init.apply(this, arguments);
+ },
+ dynamics : {
+ },
+ statics : {
+ }
+ });
+
+ module.exports = Shape;
+});
+
+define('nodes/shapes/ImageShape',['require','exports','module','common/util','nodes/shapes/Shape'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ Shape = require('nodes/shapes/Shape');
+
+ var ImageShape = util.Class({
+ name : 'ImageShape',
+ extend : Shape,
+ init : function(p){
+ ImageShape.super.init.apply(this, arguments);
+ },
+ dynamics : {
+ },
+ statics : {
+ }
+ });
+ module.exports = ImageShape;
+});
+
+define('nodes/shapes/ContainerShape',['require','exports','module','common/util','nodes/shapes/Shape'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ Shape = require('nodes/shapes/Shape');
+ //TODO : 순환참조(Cyclic)에 대해 조사할 것
+
+ var ContainerShape = util.Class({
+ name : 'ContainerShape',
+ extend : Shape,
+ init : function(p, ShapeFactory){
+ ContainerShape.super.init.apply(this, arguments);
+ if(p['children'] && p['children'].length){
+ var i, shape,
+ shapes = p['children'],
+ ShapeFactory = ContainerShape.Factory;
+ for(i in shapes){
+ shape = ShapeFactory.create(shapes[i]);
+ this.addChild(shape);
+ }
+ }
+ },
+ dynamics : {
+ },
+ statics : {
+ Factory : null,
+ create : function(p, ShapeFactory){
+ this.Factory = ShapeFactory;
+ return new this(p);
+ }
+ }
+ });
+ module.exports = ContainerShape;
+});
+
+define('nodes/ShapeFactory',['require','exports','module','common/util','bases/BaseObject','nodes/shapes/Shape','nodes/shapes/ImageShape','nodes/shapes/ContainerShape'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ BaseObject = require('bases/BaseObject'),
+ Shape = require('nodes/shapes/Shape'),
+ ImageShape = require('nodes/shapes/ImageShape'),
+ ContainerShape = require('nodes/shapes/ContainerShape');
+
+ var ShapeFactory = util.Class({
+ name : 'ShapeFactory',
+ extend : BaseObject,
+ init : function(p){
+ ShapeFactory.super.init.apply(this, arguments);
+ },
+ dynamics : {
+ },
+ statics : {
+ create : function(p){
+ //if(p.type==='Content'){p.type='Container';} //for WUF
+ if(p.hasOwnProperty('children') && p.children.length > 0){
+ p.type='Container';
+ }
+ if(p.type && this.factories[p.type]){
+ return this.factories[p.type].create(p, this);
+ }else{
+ return Shape.create(p);
+ }
+ },
+ factories : {
+ Image : ImageShape,
+ Container : ContainerShape
+ }
+ }
+ });
+
+ module.exports = ShapeFactory;
+});
+
+define('nodes/Layer',['require','exports','module','common/util','nodes/Node','nodes/ShapeFactory'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ Node = require('nodes/Node'),
+ ShapeFactory = require('nodes/ShapeFactory');
+
+ var Layer = util.Class({
+ name : 'Layer',
+ extend : Node,
+ init : function(p){
+ Layer.super.init.apply(this, arguments);
+ },
+ dynamics : {
+ addShape : function(shape){
+ this.addChild(shape);
+ }
+ },
+ statics : {
+ }
+ });
+
+ module.exports = Layer;
+});
+
+define('extras/AniGroup',['require','exports','module','common/util','common/logger','common/string','common/dom','common/css','dom/Dom','nodes/Scene','nodes/Layer','actions/Animate','bases/BaseObject','bases/Registry'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ logger = require('common/logger'),
+ string = require('common/string'),
+ dom = require('common/dom'),
+ css = require('common/css'),
+ Dom = require('dom/Dom'),
+ Scene = require('nodes/Scene'),
+ Layer = require('nodes/Layer'),
+ Animate = require('actions/Animate'),
+ BaseObject = require('bases/BaseObject'),
+ Registry = require('bases/Registry');
+
+ var makeAniGroupAni = function(id){
+ if(!dom.byId('tizenplaystyle')){
+ dom.makeElement('style',{id:'tizenplaystyle'});
+ }
+ var styleSheets = document.styleSheets,
+ lastSheet = styleSheets[styleSheets.length-1],
+ pos = lastSheet.cssRules ? lastSheet.cssRules.length : 0;
+ css.insertRule(lastSheet, '@'+css.inlinePrefix+'keyframes '+id, 'from{opacity:0} to{opacity:0.5}', pos);
+ };
+
+ var makeAniGroupElement = function(scene,id){
+ return dom.makeElement('div', {
+ id : id,
+ style : 'visibility:hidden,width:0;height:0;'
+ },{element:scene.dom.element, position:'inside'});
+ };
+
+/*
+ dom.addEvent(document, Scene.CLONE_READY, function(oEvent){
+ logger.event(Scene.CLONE_READY);
+ var i, children;
+ if(oEvent.bundle.scene){
+ children = oEvent.bundle.scene.children;
+ for(i in children){
+ if(children[i] instanceof AniGroup){
+ children[i].detectCss();
+ }
+ }
+ }
+ });
+*/
+
+ var AniGroup = util.Class({
+ name : 'AniGroup',
+ extend : Layer,
+ init : function(p){
+ AniGroup.super.init.apply(this, arguments);
+
+ //AniGroup CSS Animation
+ makeAniGroupAni(this.id);
+
+ //AniGroup.isIDE
+
+ if(AniGroup.isIDE){
+ p.iteration = 1;
+ }
+
+ //AniGroup Animate
+ //currently delay,direction,timing are fixed values
+ this.set('action', Animate.create({
+ id : this.id,
+ delay: '0s',
+ direction : 'normal',
+ timing : 'linear',
+ duration : p.duration,
+ iteration : p.iteration,
+ justplay : p.justplay,
+ holdEnd : p.holdEnd,
+ handlers : {
+ start : function(animate){
+ animate.target.playPairs();
+ dom.dispatchEvent(animate.target.dom.element,
+ AniGroup.ANI_GROUP_START, {
+ aniGroup:animate.target,
+ aniGroupId:animate.target.id,
+ animateId:animate.id
+ },true,true);
+ },
+ iteration : function(animate){
+ animate.target.stopPairs();
+ animate.target.playPairs();
+ dom.dispatchEvent(animate.target.dom.element,
+ AniGroup.ANI_GROUP_ITERATION, {
+ aniGroup:animate.target,
+ aniGroupId:animate.target.id,
+ animateId:animate.id
+ },true,true);
+ },
+ end : function(animate){
+
+ dom.dispatchEvent(animate.target.dom.element,
+ AniGroup.ANI_GROUP_END, {
+ aniGroup:animate.target,
+ aniGroupId:animate.target.id,
+ animateId:animate.id
+ },true,true);
+ setTimeout(function(animate){
+ if(animate.target){
+ animate.target.stop();
+ }
+ },50,animate);
+ },
+ resumeTime : function(animate){
+
+ animate.target.resumeTimePairs();
+ }
+ }
+ }));
+
+ //members Animate
+ if('members' in p && p.members.length){
+ var i, targetId, action, member;
+ for(i in p.members){
+ member = p.members[i];
+// if(parseFloat(member.animation.duration)>0){
+ targetId = member.id;
+ action = Animate.create(member.animation);
+ this.makePair(targetId, action);
+ this.addChild(Registry.getObjectById(targetId, 'Shape'));
+// }
+ }
+ }
+ },
+ dynamics : {
+ action : null,
+ pairs : null,
+ makePair : function(targetId, action){
+ if(!this.pairs){
+ this.pairs = {};
+ }
+ this.setAssoc('pairs', targetId, action);
+ },
+ addToScene : function(scene){
+ scene.addChild(this);
+ //AniGroup element
+ makeAniGroupElement(scene, this.id);
+ this.set('dom', Dom.create({id:this.id}));
+ },
+
+ repeater : null,
+ currentTime : 0,
+ currentTimePaused : 0,
+
+ runRepeater : function(){
+
+
+
+ if(this.repeater===null){
+ var startMs = (new Date()).getTime();
+ this.repeater = setInterval(function(that){
+ var nodeId, node, animate;
+ var delta = (new Date()).getTime() - startMs + that.currentTimePaused;
+ //
+ if(that.action.totalDuration > delta){
+ that.currentTime = delta;
+ //
+ }else{
+ that.currentTime = that.action.totalDuration;
+ }
+ dom.dispatchEvent(that.dom.element,
+ AniGroup.ANI_GROUP_TIME_UPDATE, {
+ id : that.dom.element.id,
+ currentTime : that.currentTime
+ },true,true);
+ //Sync currentTime
+ for(nodeId in that.pairs){
+ node = Registry.getObjectById(nodeId,'Node');
+ animate = that.pairs[nodeId];
+ if(node && animate){
+ animate.set('currentTime', that.currentTime - parseFloat(animate.delay)*1000);
+ //
+ }
+ }
+ },1,this);
+ }else{
+
+ }
+ },
+ pauseRepeater : function(currentTime){
+ clearInterval(this.repeater);
+ this.currentTimePaused = currentTime;
+ this.repeater = null;
+ },
+ stopRepeater : function(){
+ clearInterval(this.repeater);
+ this.repeater = null;
+ this.currentTime = 0;
+ this.currentTimePaused = 0;
+ },
+
+ play : function(){
+ var timelineState = {
+ 0 : 'IS_NORMAL',
+ 1 : 'IS_SET_TIME',
+ 2 : 'IS_RESUME_TIME',
+ 3 : 'IS_DETECT_START'
+ };
+
+
+ //Is set by Current Time
+ if(this.action.timelineState===Animate.IS_SET_TIME){
+
+
+
+
+ //normal
+ if(this.action.currentTime < this.action.totalDuration){
+ //Is set by setTime (under timeline)
+ if(this.action.state == 'pause'){
+
+ this.resumeTime();
+ //Other Case
+ }else{
+
+ console.warn('other case : see here');
+ return;
+ }
+ //overtime (stop or paused : there is a bug with webkit)
+ }else{
+
+ //init again then play
+ this.stop();
+ setTimeout(function(aniGroup){
+ aniGroup.play();
+ },10,this);
+ return;
+ }
+
+ //Normal
+ }else{
+ //Stopped (both inside and outside of duration)
+ if(this.action.state == 'stop'){
+
+ this.stopRepeater();
+ this.runAction(this.action);
+ //Paused
+ }else if(this.action.state == 'pause'){
+
+ this.resume();
+ //Other Case
+ }else{
+
+ console.warn('other case : see here');
+ return;
+ }
+ }
+ this.runRepeater();
+ },
+ resumeTime : function(){
+
+ this.action.resumeTimeWith(this);
+ },
+ resumeTimePairs : function(){
+
+ var nodeId, node, animate, delay, duration, msecToPlay;
+ for(nodeId in this.pairs){
+ node = Registry.getObjectById(nodeId,'Node');
+ animate = this.pairs[nodeId];
+ if(node && animate){
+ animate.resumeTimeWith(node);
+ }
+ }
+ },
+ pause : function(){
+
+ this.pausePairs();
+ this.pauseAction(this.action);
+ this.pauseRepeater(this.currentTime);
+ },
+ resume : function(){
+
+ this.resumeAction(this.action);
+ this.resumePairs();
+ },
+ stop : function(){
+
+ this.stopPairs();
+ this.stopAction(this.action);
+ dom.dispatchEvent(this.dom.element,
+ AniGroup.ANI_GROUP_STOP, {
+ aniGroup:this,
+ aniGroupId:this.id,
+ animateId:this.action.id
+ },true,true);
+ this.stopRepeater();
+ },
+ playPairs : function(){
+
+ var nodeId, node, animate;
+ for(nodeId in this.pairs){
+ node = Registry.getObjectById(nodeId,'Node');
+ animate = this.pairs[nodeId];
+ if(node && animate){
+ node.runAction(animate);
+ }
+ }
+ },
+ pausePairs : function(){
+
+ var nodeId, node, animate;
+ for(nodeId in this.pairs){
+ node = Registry.getObjectById(nodeId,'Node');
+ animate = this.pairs[nodeId];
+ if(node && animate){
+ node.pauseAction(animate);
+ }
+ }
+ },
+ resumePairs : function(){
+
+ var nodeId, node, animate;
+ for(nodeId in this.pairs){
+ node = Registry.getObjectById(nodeId,'Node');
+ animate = this.pairs[nodeId];
+ if(node && animate){
+ node.resumeAction(animate);
+ }
+ }
+ },
+ stopPairs : function(){
+
+ var nodeId, node, animate;
+ for(nodeId in this.pairs){
+ node = Registry.getObjectById(nodeId,'Node');
+ animate = this.pairs[nodeId];
+ if(node && animate){
+ //TODO Should I check exist then stop it?
+ node.stopAction(animate);
+ }
+ }
+ },
+ goToStartFrame : function(){
+
+ this.stopRepeater();
+ this.action.goToStartFrameWith(this);
+ var nodeId, node, animate;
+ for(nodeId in this.pairs){
+ node = Registry.getObjectById(nodeId,'Node');
+ animate = this.pairs[nodeId];
+ if(node && animate){
+ animate.goToStartFrameWith(node);
+ }
+ }
+ },
+ resetAniGroup : function(){
+
+ this.stopRepeater();
+ this.action.goToStartFrameWith(this);
+ var nodeId, node, animate;
+ for(nodeId in this.pairs){
+ node = Registry.getObjectById(nodeId,'Node');
+ animate = this.pairs[nodeId];
+ if(node && animate){
+ animate.goToStartFrameWith(node);
+ }
+ }
+ },
+ setCurrentTime : function(msec){
+
+
+ var nodeId, node, animate, delay, duration, msecToPlay, groupLooped;
+
+ //overtime
+ if(msec >= this.action.totalDuration){
+ msecToPlay = this.action.totalDuration;
+
+ //msecToPlay = msecToPlay;
+ //this.action.set('state','stop');
+ }else{
+ msecToPlay = msec;
+ }
+ this.action.setTimeWith(this, msecToPlay);
+
+ //groupLooped
+ groupLooped = this.action.totalDuration*this.action.iterated;
+ //
+
+ //first
+ if(parseFloat(msec)===0){
+ this.stopRepeater();
+ //last
+ }else if(parseFloat(msec)===this.action.totalDuration){
+ this.stopRepeater();
+ //normal
+ }else{
+ this.pauseRepeater(msec);
+ }
+
+ for(nodeId in this.pairs){
+ node = Registry.getObjectById(nodeId,'Node');
+ animate = this.pairs[nodeId];
+ if(node && animate){
+
+ //over totalDuration
+ if(msec >= this.action.totalDuration){
+ msecToPlay = this.action.totalDuration - parseFloat(animate.delay)*1000;
+
+ //msecToPlay = msecToPlay;
+ //animate.set('state','stop');
+ }else{
+ delay = parseFloat(animate.delay)*1000;
+ duration = parseFloat(animate.duration)*1000;
+ //
+ msecToPlay = msec - delay - groupLooped; //distance from start play
+ //
+ //
+ }
+ animate.setTimeWith(node, msecToPlay);
+ }
+ }
+
+
+ },
+ getCss : function(){
+
+ var nodeId, node, animate, element;
+ for(nodeId in this.pairs){
+ node = Registry.getObjectById(nodeId,'Node');
+ animate = this.pairs[nodeId];
+ if(node && animate){
+ element = node.dom.element;
+ //fire onSetTime event
+ Animate.dispatchSetTimeEvent(
+ element,
+ '#'+element.id, //TODO modify to Selector (until 1st week of Oct)
+ animate.currentTime
+ );
+ }
+ }
+ },
+ detectCss : function(){
+
+ var nodeId, node, animate;
+ this.action.detectStyleWith(this); //group
+ for(nodeId in this.pairs){
+ node = Registry.getObjectById(nodeId,'Node');
+ animate = this.pairs[nodeId];
+ if(node && animate){
+ animate.detectStyleWith(node); //node
+ }
+ }
+ }
+ },
+ statics : {
+ isIDE : false,
+ ANI_GROUP_START : 'aniGroupStart',
+ ANI_GROUP_ITERATION : 'aniGroupIteration',
+ ANI_GROUP_END : 'aniGroupEnd',
+ ANI_GROUP_STOP : 'aniGroupStop',
+ ANI_GROUP_TIME_UPDATE : 'aniGroupTimeUpdate'
+ }
+ });
+
+ module.exports = AniGroup;
+});
+
+define('nodes/Movie',['require','exports','module','common/util','common/dom','nodes/Node','extras/AniGroup'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ dom = require('common/dom'),
+ Node = require('nodes/Node'),
+ AniGroup = require('extras/AniGroup');
+
+ var Movie = util.Class({
+ name : 'Movie',
+ extend : Node,
+ init : function(p){
+ Movie.super.init.apply(this, arguments);
+ dom.addEvent(window, 'loadScene', function(oEvent){
+ oEvent.bundle.scene.play();
+ });
+ },
+ dynamics : {
+ oldScene : null,
+ currentScene : null,
+ addScene : function(scene){
+
+ this.addChild(scene);
+ },
+ loadSceneById : function(sceneId){
+
+ if(sceneId){
+ var scene = this.getChildById(sceneId);
+ this.loadScene(scene);
+ }
+ },
+ loadScene : function(scene){
+
+ this.set('oldScene',this.get('currentScene'));
+ this.set('currentScene',scene);
+
+ if(!dom.byId('clone_'+scene.dom.element.id)){
+ scene.clone();
+ setTimeout(function(that,scene){
+ that.detectCss(scene);
+ setTimeout(function(scene){
+ dom.dispatchEvent(window, 'loadScene', {scene:scene});
+ },50,scene);
+ },50,this,scene);
+ }else{
+ this.detectCss(scene);
+ setTimeout(function(scene){
+ dom.dispatchEvent(window, 'loadScene', {scene:scene});
+ },50,scene);
+ }
+ },
+ detectCss : function(scene){
+
+ var i, children = scene.children;
+ for(i in children){
+ if(children[i] instanceof AniGroup){
+ children[i].detectCss();
+ }
+ }
+ }
+ },
+ statics : {
+ }
+ });
+
+ module.exports = Movie;
+});
+
+
+
+
+define('facade/MovieManager',['require','exports','module','common/util','bases/BaseObject','bases/Registry','nodes/Node','nodes/Movie','nodes/Scene','nodes/Layer','nodes/ShapeFactory','extras/AniGroup'],function(require, exports, module) {
+
+ var util = require('common/util'),
+ BaseObject = require('bases/BaseObject'),
+ Registry = require('bases/Registry'),
+ Node = require('nodes/Node'),
+ Movie = require('nodes/Movie'),
+ Scene = require('nodes/Scene'),
+ Layer = require('nodes/Layer'),
+ ShapeFactory = require('nodes/ShapeFactory'),
+ AniGroup = require('extras/AniGroup');
+
+ var MovieManager = util.Class({
+ name : 'MovieManager',
+ extend : BaseObject,
+ init : function(p){
+ MovieManager.super.init.apply(this, arguments);
+ },
+ dynamics : {
+ movie : null,
+ loadScenario : function(scenario){
+
+ var i, j, k, g,
+ scenes, layers, shapes, aniGroups,
+ movie, scene, layer, shape, aniGroup;
+
+ movie = Movie.create({id:'movie'});
+
+ //scenes
+ if('scenes' in scenario){
+ scenes = scenario['scenes'];
+ for(i in scenes){
+
+ scene = Scene.create(scenes[i]);
+ movie.addScene(scene);
+ if(scenes[i].show){
+
+ movie.set('currentScene',scene);
+ }
+
+ //layers
+ if('layers' in scenes[i]){
+ layers = scenes[i]['layers'];
+ for(j in layers){
+ layer = Layer.create(layers[j]);
+ scene.addLayer(layer);
+ //shapes
+ if('shapes' in layers[j]){
+ shapes = layers[j]['shapes'];
+ for(k in shapes){
+ shape = ShapeFactory.create(shapes[k]);
+ layer.addShape(shape);
+ }
+ }
+ }
+ }
+
+ //aniGroups
+ if('aniGroups' in scenes[i]){
+ aniGroups = scenes[i]['aniGroups'];
+ for(g in aniGroups){
+ if(!BaseObject.isEmpty(aniGroups[g])){
+ aniGroup = AniGroup.create(aniGroups[g]);
+ aniGroup.addToScene(scene);
+ }
+ }
+ //addEventListeners
+ //AniGroup.addAniEvent(scene);
+ }
+
+ //duplicate scene element
+ //2013.12.10 for pageshow
+ //scene.clone();
+ }
+ }
+
+ this.movie = movie;
+ return movie;
+ },
+ addWidget : function(id, containerId, animateId, angroupId, type){
+
+ var container = Registry.getObjectById(containerId);
+ var shape = ShapeFactory.create({
+ id : id,
+ type : type
+ });
+ container.addChild(shape);
+ var aniGroup = Registry.getObjectById(angroupId, 'AniGroup');
+
+ //make <Animate> instance
+ //add to <Group> instance
+ //TODO : this function has been canceled 2013.10.16
+ //We need to make this function again on 2014 for webida.
+ }
+ },
+ statics : {
+ singleton : null,
+ create : function(){
+ if(this.singleton==null){
+ this.singleton = new this();
+ }
+ return this.singleton;
+ }
+ }
+ });
+
+ module.exports = MovieManager;
+});
+
+define('common/bootstrap',['require','exports','module','common/env'],function(require, exports, module) {
+
+ var env = require('common/env');
+
+ module.exports = {
+ init : function(p){
+
+ env.init(p);
+ }
+ };
+});
+
+
+define('proxy/wub/TizenPlay',['require','exports','module','facade/MovieManager','common/bootstrap','common/logger','common/string','common/dom','nodes/ShapeFactory','nodes/Scene','bases/Registry','actions/Animate','extras/AniGroup'],function(require, exports, module) {
+
+ var MovieManager = require('facade/MovieManager'),
+ bootstrap = require('common/bootstrap'),
+ logger = require('common/logger'),
+ string = require('common/string'),
+ dom = require('common/dom'),
+ ShapeFactory = require('nodes/ShapeFactory'),
+ Scene = require('nodes/Scene'),
+ Registry = require('bases/Registry'),
+ Animate = require('actions/Animate'),
+ AniGroup = require('extras/AniGroup');
+
+ var consoleStyle = 'font-size:14pt; font-weight:bold';
+
+ /**
+ Users can see this object only.
+ These are set of facade functions of inner modules.
+
+ @class TizenPlay
+ **/
+ var TizenPlay = {
+ movieManager : null,
+ movie : null,
+ logger : logger,
+ dom : dom,
+ string : string,
+ Animate : Animate,
+ ShapeFactory : ShapeFactory,
+ Registry : Registry,
+ log : function(){
+
+ },
+
+ init : function(){
+
+ bootstrap.init({
+ useJQuery : true
+ });
+
+ if(typeof tizenPlayIsIDE != 'undefined' && tizenPlayIsIDE === true){
+ AniGroup.isIDE = true;
+ }
+
+ dom.addEvent(window, 'loadScene', function(oEvent){
+ logger.event('loadScene : '+oEvent.bundle.scene.id);
+
+ if(AniGroup.isIDE === false){
+ TizenPlay.playPage(oEvent.bundle.scene);
+ }
+ });
+ },
+
+ bindTizenEvents : function(config){
+
+ //
+ var i, j, k,
+ scenes, layers, shapes,
+ fn;
+
+ if(typeof jQuery =='undefined'){
+
+ return;
+ }
+
+ if(typeof jQuery('body').live === 'function'){
+ fn='live';
+ }else{
+ fn='on';
+ }
+
+ var bindEvent = function(shape){
+ var events, eventName, handler, i;
+ //
+ if(shape.children){
+ for(i in shape.children){
+ bindEvent(shape.children[i]);
+ }
+ }
+ if(shape.events){
+ events = shape.events;
+ for(eventName in events){
+ for(i in events[eventName]){
+ handler = events[eventName][i];
+
+ jQuery('#'+shape.id)[fn](eventName, function(oEvent){
+ logger.event(oEvent.target+' '+oEvent.type);
+
+ setTimeout(function(handler){
+ if(handler.type==='AniGroup'){
+ var aniGroup = Registry.getObjectById(handler.target, 'AniGroup');
+ aniGroup[handler.act](handler.time);
+ }
+ },100,handler);
+ });
+ }
+ }
+ }
+ };
+
+ if('scenes' in config){
+ scenes = config['scenes'];
+ for(i in scenes){
+
+ jQuery('#'+scenes[i].id).on('pageshow', function(event){
+ var pageId = jQuery(this).attr('id');
+ setTimeout(function(pageId){
+ logger.event('pageshow : '+pageId);
+ TizenPlay.movie.loadSceneById(pageId);
+ },100,pageId);
+ });
+
+ bindEvent(scenes[i]);
+ if('layers' in scenes[i]){
+ layers = scenes[i]['layers'];
+ for(j in layers){
+ if('shapes' in layers[j]){
+ shapes = layers[j]['shapes'];
+ for(k in shapes){
+ bindEvent(shapes[k]);
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+
+ addWidget : function(id, containerId, animateId, angroupId, type){
+ this.movieManager.addWidget(id, containerId, angroupId, type);
+ },
+
+ /**
+ Update animation at runtime.
+ This fire ANI_GROUP_DURATION_UPDATE event. See ANI_GROUP_DURATION_UPDATE.
+
+ @method updateAnimation
+ @example
+ TizenPlay.updateAnimation('anim1', 'image1', 'aniImage1', 1000, 2062.5);
+ @param {String} aniGroupId aniGroup' id
+ @param {String} nodeId animation's target node id
+ @param {String} animateId animation's id
+ @param {Float} duration duration (miliseconds)
+ @param {Float} delay delay (miliseconds)
+ **/
+ updateAnimation : function(aniGroupId, nodeId, animateId, duration, delay){
+
+
+ var aniGroup = Registry.getObjectById(aniGroupId, 'AniGroup');
+ var node = aniGroup.getChildById(nodeId);
+
+ var animate = Registry.getObjectById(animateId, 'Animate');
+
+ animate.update(duration, delay);
+ animate.setTimeWith(node, animate.currentTime, true);
+
+ var i, ani, tmpLen, playLen=0;
+ for(i in aniGroup.pairs){
+ ani = aniGroup.pairs[i];
+ tmpLen = parseFloat(ani.delay)*1000 + parseFloat(ani.duration)*1000;
+ if(tmpLen > playLen){
+ playLen = tmpLen;
+ }
+ }
+
+ if(playLen != parseFloat(aniGroup.action.duration)*1000){
+ aniGroup.action.update(playLen, 0);
+ aniGroup.action.setTimeWith(aniGroup, aniGroup.action.currentTime, true);
+
+ TizenPlay.dom.dispatchEvent(
+ document,
+ TizenPlay.ANI_GROUP_DURATION_UPDATE,
+ {id:aniGroup.id, duration:aniGroup.action.duration},
+ true, true);
+ }
+ },
+
+ /**
+ You should call this method when you add new Animation to a widget.
+ This will detect css of start position.
+
+ @method applyAnimation
+ @example
+ TizenPlay.applyAnimation('image1', 'aniImage1');
+ @param {String} nodeId animation's target node id
+ @param {String} animateId animation's id
+ **/
+ applyAnimation : function(nodeId, animateId){
+
+ var node = Registry.getObjectById(nodeId, 'Node');
+ var animate = Registry.getObjectById(animateId, 'Animate');
+ animate.detectStyleWith(node);
+ },
+
+ /**
+ Loads animation model.
+
+ @method loadPlayModel
+ @example
+ TizenPlay.loadPlayModel(tizen_animator_cfg);
+ @param {Object} config configuration object (aka model).
+ **/
+ loadPlayModel : function(config){
+
+ //var scenario = this.convertToScenario(config);
+ var scenario = config;
+ var getLastChild = function(shapes){
+ var lastShape = shapes[shapes.length-1];
+ if(lastShape.children){
+ return getLastChild(lastShape.children);
+ }else{
+ return lastShape;
+ }
+ };
+
+ if(!scenario.scenes[0].layers[0].shapes){
+ throw new Error('shapes not defined');
+ }
+ var shapes = scenario.scenes[0].layers[0].shapes;
+ var lastChild = getLastChild(shapes);
+
+
+ //check once
+ if(document.getElementById(lastChild.id)){
+ this.movieManager = MovieManager.create();
+ this.movie = this.movieManager.loadScenario(scenario);
+ setTimeout(function(that){
+
+
+
+ //2013.12.09 bacause of pageshow
+ if(AniGroup.isIDE === true){
+
+ try{
+ that.movie.loadScene(that.movie.currentScene);
+ }catch(e){
+
+ }
+ }
+
+ TizenPlay.dom.dispatchEvent(
+ window,
+ TizenPlay.LOAD_PLAY_MODEL, {movie:this.movie},
+ true, true);
+ },300,this);
+
+ return true;
+ }else{
+ console.warn(lastChild.id+' element not found');
+ return false;
+ }
+ },
+
+ /**
+ Gets animation groups from Scene object.
+
+ @method getAniGroups
+ @example
+ TizenPlay.getAniGroups(scene1);
+ @param {Object} scene Scene instance
+ @return {Array} [AniGroups]
+ **/
+ getAniGroups : function(scene){
+ var i, result=[];
+ for(i in scene.children){
+ if(scene.children[i] instanceof AniGroup){
+ result.push(scene.children[i]);
+ }
+ }
+ return result;
+ },
+
+ /**
+ Gets animation groups from Scene object by state.
+
+ @method getGroupsByState
+ @example
+ TizenPlay.getGroupsByState(scene1);
+ @param {Object} scene Scene instance
+ @param {String} state 'run' | 'pause' | 'stop'
+ @return {Array} [AniGroups]
+ **/
+ getGroupsByState : function(scene, state){
+ var i, result=[],
+ aniGroups=this.getAniGroups(scene);
+ for(i in aniGroups){
+
+
+
+ if(aniGroups[i].action.state===state){
+ result.push(aniGroups[i]);
+ }
+ }
+ return result;
+ },
+
+ /**
+ Gets animation groups from Registry by id(s).
+
+ @method getGroupsById
+ @example
+ TizenPlay.getGroupsById('Anim1');
+ TizenPlay.getGroupsById(['Anim1','Anim2']);
+ @param {Mixed} ids
+ @return {Array} [AniGroups]
+ **/
+ getGroupsById : function(ids){
+ var i, result=[], aniGroup;
+ if(typeof ids ==='string'){
+ ids = [ids];
+ }
+ for(i in ids){
+ aniGroup = Registry.getObjectById(ids[i],'AniGroup');
+ if(aniGroup){
+ result.push(aniGroup);
+ }
+ }
+ return result;
+ },
+
+ /**
+ Gets animation groups to be play automatically.
+
+ @method getJustPlayGroups
+ @example
+ TizenPlay.getJustPlayGroups(scene1);
+ @param {Object} scene Scene instance
+ @return {Array} [AniGroups]
+ **/
+ getJustPlayGroups : function(scene){
+ var i, result=[],
+ aniGroups=this.getAniGroups(scene);
+ for(i in aniGroups){
+ if(aniGroups[i].action.justplay===true){
+ result.push(aniGroups[i]);
+ }
+ }
+ return result;
+ },
+
+ /**
+ Gets current active page.
+
+ @method getCurrentPage
+ @example
+ TizenPlay.getCurrentPage();
+ @return {Object} scene Scene instance
+ **/
+ getCurrentPage : function(){
+
+ return this.movie.get('currentScene');
+ },
+
+ /**
+ Plays all animation groups of current active page.
+
+ @method playCurrentPage
+ @example
+ TizenPlay.playCurrentPage();
+ **/
+ playCurrentPage : function(){
+
+ this.playPage(this.movie.get('currentScene'));
+ },
+
+ /**
+ Plays animation groups of page by Scene object (autoPlay true case only).
+
+ @method playPage
+ @example
+ TizenPlay.playPage(scene1);
+ @param {Object} scene Scene instance
+ **/
+ playPage : function(scene){
+
+ this.playAniGroups(scene, this.getJustPlayGroups(scene));
+ },
+
+ /**
+ Plays all animation groups of page by pageId
+
+ @method playPageById
+ @example
+ TizenPlay.playPageById('page1');
+ @param {String} pageId page's id.
+ **/
+ playPageById : function(pageId){
+
+ this.playPage(Registry.getObjectById(pageId,'Scene'));
+ },
+
+ /**
+ Plays all animation groups of page by Scene object.
+
+ @method playAllAniGroups
+ @example
+ TizenPlay.playAllAniGroups(scene1);
+ @param {Object} scene Scene instance
+ **/
+ playAllAniGroups : function(scene){
+
+ this.playAniGroups(scene, this.getAniGroups(scene));
+ },
+
+ /**
+ Plays animation groups on a page.
+
+ @method playAniGroups
+ @example
+ TizenPlay.playAniGroups(scene1, [aniGroup1, aniGroup2]);
+ @param {Object} scene Scene instance.
+ @param {Array} aniGroups Array of AniGroup instances.
+ **/
+ playAniGroups : function(scene, aniGroups){
+
+
+ var i,
+ check = {stop:0,pause:0,run:0};
+ for(i in aniGroups){
+ check[aniGroups[i].action.state]++;
+ }
+ //nothing run
+ if(check['run']===0){
+ //if all stopped or paused
+ if(check['pause']===0 || check['stop']===0){
+ for(i in aniGroups){
+ aniGroups[i].play();
+ }
+ //if some groups are stopped,
+ //run `paused groups` only
+ }else{
+ for(i in aniGroups){
+ if(aniGroups[i].action.state==='pause'){
+
+ aniGroups[i].play();
+ }
+ }
+ }
+ }
+ },
+
+ /**
+ Plays animation groups on a page.
+
+ @method playAniGroupsById
+ @example
+ TizenPlay.playAniGroupsById('page1', 'Anim1');
+ TizenPlay.playAniGroupsById('page1', ['Anim1', 'Anim2']);
+ @param {String} pageId page's id.
+ @param {Mixed} aniGroupIds The animation groups' ids.
+ **/
+ playAniGroupsById : function(pageId, aniGroupIds){
+
+ var scene = Registry.getObjectById(pageId,'Scene');
+ var aniGroups = this.getGroupsById(aniGroupIds);
+ this.playAniGroups(scene, aniGroups);
+ },
+
+ /**
+ Pauses current page's all animation group(s).
+
+ @method pauseCurrentPage
+ @example
+ TizenPlay.pauseCurrentPage();
+ **/
+ pauseCurrentPage : function(){
+
+ this.pausePage(this.movie.get('currentScene'));
+ },
+
+ /**
+ Pauses running animation group(s) of a page.
+
+ @method pausePage
+ @example
+ TizenPlay.pausePage(scene1);
+ @param {Object} scene Scene instance
+ **/
+ pausePage : function(scene){
+
+ this.pauseAniGroups(scene, this.getGroupsByState(scene,'run'));
+ },
+
+ /**
+ Pauses running animation group(s) of a page by pageId.
+
+ @method pausePageById
+ @example
+ TizenPlay.pausePageById('page1');
+ @param {String} pageId page's id.
+ **/
+ pausePageById : function(pageId){
+
+ this.pausePage(Registry.getObjectById(pageId,'Scene'));
+ },
+
+ /**
+ Pauses animation group(s) on a page.
+
+ @method pauseAniGroups
+ @example
+ TizenPlay.pauseAniGroups(scene1, [aniGroup1, aniGroup2]);
+ @param {Object} scene Scene instance.
+ @param {Array} aniGroups Array of AniGroup instances.
+ **/
+ pauseAniGroups : function(scene, aniGroups){
+ var aniGroupIds=[];
+ for(var i in aniGroups){
+ aniGroupIds.push(aniGroups[i].id);
+ }
+
+ var i;
+ for(i in aniGroups){
+ aniGroups[i].pause();
+ }
+ },
+
+ /**
+ Pauses animation group(s) on a page by Ids.
+
+ @method pauseAniGroupsById
+ @example
+ TizenPlay.pauseAniGroupsById('page1', 'Anim1');
+ TizenPlay.pauseAniGroupsById('page1', ['Anim1', 'Anim2']);
+ @param {String} pageId page's id.
+ @param {Mixed} aniGroupIds The animation groups' ids.
+ **/
+ pauseAniGroupsById : function(pageId, aniGroupIds){
+
+ var scene = Registry.getObjectById(pageId,'Scene');
+ var aniGroups = this.getGroupsById(aniGroupIds);
+ this.pauseAniGroups(scene, aniGroups);
+ },
+
+ /**
+ Stops current page's all animation group(s).
+
+ @method stopCurrentPage
+ @example
+ TizenPlay.stopCurrentPage();
+ **/
+ stopCurrentPage : function(){
+
+ this.stopPage(this.movie.get('currentScene'));
+ },
+
+ /**
+ Stops all the animation group(s) of a page.
+
+ @method stopPage
+ @example
+ TizenPlay.stopPage(scene1);
+ @param {Object} scene Scene instance
+ **/
+ stopPage : function(scene){
+
+ this.stopAniGroups(scene, this.getAniGroups(scene));
+ },
+
+ /**
+ Stops all the animation group(s) of a page by pageId.
+
+ @method stopPageById
+ @example
+ TizenPlay.stopPageById('page1');
+ @param {String} pageId page's id.
+ **/
+ stopPageById : function(pageId){
+
+ this.stopPage(Registry.getObjectById(pageId,'Scene'));
+ },
+
+ /**
+ Stops animation group(s) on a page.
+
+ @method stopAniGroups
+ @example
+ TizenPlay.stopAniGroups(scene1, [aniGroup1, aniGroup2]);
+ @param {Object} scene Scene instance.
+ @param {Array} aniGroups Array of AniGroup instances.
+ **/
+ stopAniGroups : function(scene, aniGroups){
+
+ var i;
+ for(i in aniGroups){
+ aniGroups[i].stop();
+ }
+ },
+
+ /**
+ Stops animation group(s) on a page by ids.
+
+ @method stopAniGroupsById
+ @example
+ TizenPlay.stopAniGroupsById('page1', 'Anim1');
+ TizenPlay.stopAniGroupsById('page1', ['Anim1', 'Anim2']);
+ @param {String} pageId page's id.
+ @param {Mixed} aniGroupIds The animation groups' ids.
+ **/
+ stopAniGroupsById : function(pageId, aniGroupIds){
+
+ var scene = Registry.getObjectById(pageId,'Scene');
+ var aniGroups = this.getGroupsById(aniGroupIds);
+ this.stopAniGroups(scene, aniGroups);
+ },
+
+ /**
+ Go to first frame of (a) aniGroup(s) in the current page(Scene).
+ This will dispatch TizenPlay.SET_TIME ('setTime') event to the elements of the group.
+
+ @method goToStartFrame
+ @example
+ TizenPlay.goToStartFrame('Anim1');
+ TizenPlay.goToStartFrame(['Anim1', 'Anim2']);
+ @param {Mixed} [groupIds] The animation group id(s).
+ **/
+ goToStartFrame : function(groupIds){
+
+ var aniGroups, i;
+ if(groupIds){
+ if(typeof groupIds ==='string'){groupIds=[groupIds];}
+ aniGroups = this.getGroupsById(groupIds);
+ }else{
+ aniGroups = this.getAniGroups(this.movie.get('currentScene'));
+ }
+ for(i in aniGroups){
+ aniGroups[i].goToStartFrame();
+ }
+ },
+
+ /**
+ Moves animations to a specific time. If you omit groupId, all AniGroups will be moved.
+
+ @method setCurrentTime
+ @example
+ TizenPlay.setCurrentTime(2500);
+ TizenPlay.setCurrentTime(2500, 'Anim1');
+ TizenPlay.setCurrentTime(2500, ['Anim1','Anim2']);
+ @param {Integer} msec The milisecond time to move.
+ @param {Mixed} [groupIds] The animation group id(s).
+ @return {Object} CSS Properties of the contained widgets.
+ **/
+ setCurrentTime : function(msec, groupIds){
+
+ var aniGroups, i;
+ if(groupIds){
+ if(typeof groupIds ==='string'){groupIds=[groupIds];}
+ aniGroups = this.getGroupsById(groupIds);
+ }else{
+ aniGroups = this.getAniGroups(this.movie.get('currentScene'));
+ }
+ for(i in aniGroups){
+ aniGroups[i].setCurrentTime(msec);
+ }
+ },
+
+ /**
+ Get css from animation group
+
+ @method getCssByGroupId
+ @example
+ TizenPlay.getCssByGroupId('Anim1');
+ TizenPlay.getCssByGroupId(['Anim1','Anim2']);
+ @param {Mixed} [groupIds] The animation group id(s).
+ @return {Object} CSS Properties of the contained widgets by setTime event.
+ **/
+ getCssByGroupId : function(groupIds){
+
+ var aniGroups, i;
+ if(groupIds){
+ if(typeof groupIds ==='string'){groupIds=[groupIds];}
+ aniGroups = this.getGroupsById(groupIds);
+ }else{
+ aniGroups = this.getAniGroups(this.movie.get('currentScene'));
+ }
+ for(i in aniGroups){
+ aniGroups[i].getCss();
+ }
+ },
+
+ /**
+ Sets widget element's visibility
+
+ @method setVisible
+ @example
+ TizenPlay.setVisible('image1', true);
+ @param {String} nodeId animation's target node id
+ @param {Boolean} isVisible true to visible, false to hidden
+ **/
+ setVisible : function(nodeId, isVisible){
+
+ var node = Registry.getObjectById(nodeId, 'Node');
+ node.set('visible', isVisible);
+
+ },
+
+ /**
+ When an aniGroup start, this event will be fired on an animation group element(invisible).
+
+ @event ANI_GROUP_START
+ @bubbles true
+ @param {Event} event As a result, event object's bundle object would contain Object similar to this
+ : {aniGroupId: "Anim1", animateId: "Anim1"}
+ @value {String} 'aniGroupStart'
+ @example
+ document.addEventListener(TizenPlay.ANI_GROUP_START, function(oEvent){
+ **/
+ ANI_GROUP_START : AniGroup.ANI_GROUP_START,
+
+ /**
+ When an aniGroup iteration start, this event will be fired on an animation group element(invisible).
+
+ @event ANI_GROUP_ITERATION
+ @bubbles true
+ @param {Event} event As a result, event object's bundle object would contain Object similar to this
+ : {aniGroupId: "Anim1", animateId: "Anim1"}
+ @value {String} 'aniGroupIteration'
+ @example
+ document.addEventListener(TizenPlay.ANI_GROUP_ITERATION, function(oEvent){
+ **/
+ ANI_GROUP_ITERATION : AniGroup.ANI_GROUP_ITERATION,
+
+ /**
+ When an aniGroup end, this event will be fired on an animation group element(invisible).
+
+ @event ANI_GROUP_END
+ @bubbles true
+ @param {Event} event As a result, event object's bundle object would contain Object similar to this
+ : {aniGroupId: "Anim1", animateId: "Anim1"}
+ @value {String} 'aniGroupEnd'
+ @example
+ document.addEventListener(TizenPlay.ANI_GROUP_END, function(oEvent){
+ **/
+ ANI_GROUP_END : AniGroup.ANI_GROUP_END,
+
+ /**
+ The stop event is called when aniGroup's animation ended or an user stops aniGroup's animation.
+ This event would be dispatched after TizenPlay.ANI_GROUP_END event.
+
+ @event ANI_GROUP_STOP
+ @bubbles true
+ @param {Event} event As a result, event object's bundle object would contain Object similar to this
+ : {aniGroupId: "Anim1", animateId: "Anim1"}
+ @value {String} 'aniGroupStop'
+ @example
+ document.addEventListener(TizenPlay.ANI_GROUP_STOP, function(oEvent){
+ **/
+ ANI_GROUP_STOP : AniGroup.ANI_GROUP_STOP,
+
+ /**
+ Called when all the aniGroup's animation has been ended.
+
+ @event ALL_ANI_GROUP_STOP
+ @bubbles true
+ @value {String} 'allAniGroupStop'
+ @example
+ document.addEventListener(TizenPlay.ALL_ANI_GROUP_STOP, function(oEvent){
+ **/
+ ALL_ANI_GROUP_STOP : 'allAniGroupStop',
+
+ /**
+ Called when AniGroup instance's setCurrentTime() method is called.
+ Event Object has a bundle object that contains selector name, css collection of the element
+ and currentTime of the Animate Class instance. See examples.
+
+ @event SET_TIME
+ @bubbles true
+ @value {String} 'setTime'
+ @example
+ document.addEventListener(TizenPlay.SET_TIME, function(oEvent){
+ document.addEventListener(
+ TizenPlay.SET_TIME, function(oEvent){
+
+ });
+ **/
+ SET_TIME : 'setTime',
+
+ /**
+ Called when an aniGroup is playing
+
+ @event ANI_GROUP_TIME_UPDATE
+ @bubbles true
+ @value {String} 'aniGroupTimeUpdate'
+ @example
+ document.addEventListener(TizenPlay.ANI_GROUP_TIME_UPDATE, function(oEvent){
+
+ //{id: "anim2", currentTime: 5379}
+ });
+ **/
+ ANI_GROUP_TIME_UPDATE : AniGroup.ANI_GROUP_TIME_UPDATE,
+
+ /**
+ Called when an aniGroup duration changed by sub animation.
+
+ @event ANI_GROUP_DURATION_UPDATE
+ @bubbles true
+ @value {String} 'aniGroupDurationUpdate'
+ @example
+ document.addEventListener(TizenPlay.ANI_GROUP_DURATION_UPDATE, function(oEvent){
+
+ //{id:'aniGroup1', duration: 2100}
+ });
+ **/
+ ANI_GROUP_DURATION_UPDATE : 'aniGroupDurationUpdate',
+
+ /**
+ Called when the TizenPlay Framework is ready to use.
+ You must use String 'tizenPlayReady' rather than constant TizenPlay.TIZEN_PLAY_READY
+ because of AMD issue (Require.js loads modules asynchronously).
+
+ @event TIZEN_PLAY_READY
+ @bubbles true
+ @value {String} 'tizenPlayReady'
+ @example
+ window.addEventListener('tizenPlayReady', function(oEvent){
+ **/
+ TIZEN_PLAY_READY : 'tizenPlayReady',
+
+ /**
+ Called when the new animation config loaded.
+
+ @event LOAD_PLAY_MODEL
+ @bubbles true
+ @value {String} 'loadPlayModel'
+ @example
+ window.addEventListener(TizenPlay.LOAD_PLAY_MODEL, function(oEvent){
+
+ //{movie: Movie Node Object}
+ });
+ **/
+ LOAD_PLAY_MODEL : 'loadPlayModel',
+
+ convertToScenario : function(cfg){
+ var scenario={},
+ pages,
+ scene,
+ i, j, k;
+
+ var eventByType = function(action){
+ switch(action['type']){
+ case 'animation':
+ if(action['animationWidget']==='All'){
+ return {
+ id : action['id'],
+ type : 'AniGroup',
+ target : action['targetId'],
+ act : action['method']
+ };
+ }else{
+ return {
+ id : action['id'],
+ type : 'Animation',
+ target : action['animationWidget'],
+ act : action['method']
+ };
+ }
+ case 'others' :
+ return {
+ //TODO
+ };
+ break;
+ default:
+ }
+ };
+
+ var convertTrigs = function(trigs){
+ if(!trigs){return null;}
+ var i, j, events={}, eventSet, actions;
+ for(i in trigs){
+ eventSet = new Array();
+ actions = trigs[i]['actions'];
+ for(j in actions){
+ eventSet.push(eventByType(actions[j]));
+ }
+ events[trigs[i]['eventName']] = eventSet;
+ }
+ return events;
+ };
+
+ var convertWizs = function(widgets){
+ if(!widgets){return null;}
+ var i, shapes=[];
+ for(i in widgets){
+ if( widgets[i]['childWidgets'] &&
+ widgets[i]['childWidgets'].length){
+ widgets[i]['type'] = 'Container';
+ }
+ shapes.push({
+ id : widgets[i]['id'],
+ type : widgets[i]['type'],
+ children : convertWizs(widgets[i]['childWidgets']),
+ animation : null, // no need to convert cause of aniGroups
+ events : convertTrigs(widgets[i]['triggers'])
+ });
+ }
+ return shapes;
+ };
+
+ var convertAnims = function(anims){
+ var i, j, aniGroups=[], members, keyframes, kf;
+ for(i in anims){
+ if('keyframes' in anims[i] && anims[i]['keyframes'].length){
+ members = new Array();
+ keyframes = anims[i]['keyframes'];
+ for(j in keyframes){
+ kf = keyframes[j];
+ members.push({
+ id : kf['targetId'],
+ animation : {
+ id : kf['id'],
+ delay: kf['delay'],
+ duration : kf['duration'],
+ iteration : kf['iteration'],
+ direction : 'normal',
+ timing : kf['easing'],
+ holdEnd : kf['holdEnd'],
+ justplay : kf['active']
+ }
+ });
+ }
+ aniGroups.push({
+ id : anims[i]['id'],
+ members : members,
+ duration : anims[i]['duration'],
+ iteration : anims[i]['iteration'],
+ holdEnd : anims[i]['holdEnd'],
+ justplay : anims[i]['autoPlay']
+ });
+ }
+ }
+ return aniGroups;
+ };
+
+ //pages
+ if('pages' in cfg){
+ pages = cfg['pages'];
+ scenario['scenes'] = new Array();
+ for(i in pages){
+ scene = {
+ id : pages[i]['id'],
+ show : pages[i]['active'],
+ transit : pages[i]['transition'],
+ layers : [{
+ id : 'layer'+(1+parseInt(i)),
+ shapes : convertWizs(pages[i]['widgets']),
+ animation : null, // not exist in tizenModel
+ events : null // not exist in tizenModel
+ }],
+ animation : null, // not exist in tizenModel
+ events : convertTrigs(pages[i]['triggers']),
+ aniGroups : convertAnims(pages[i]['animations'])
+ };
+ scenario['scenes'].push(scene);
+ }
+ }
+
+ return scenario;
+ }
+ };
+
+ TizenPlay.dom.addEvent(document, TizenPlay.ANI_GROUP_START, function(oEvent){
+
+ });
+
+ TizenPlay.dom.addEvent(document, TizenPlay.ANI_GROUP_STOP, function(oEvent){
+ logger.event(TizenPlay.ANI_GROUP_STOP);
+ var scene = oEvent.bundle.aniGroup.parent,
+ aniGroups = TizenPlay.getAniGroups(scene),
+ stopGroups = TizenPlay.getGroupsByState(scene,'stop');
+ //
+ setTimeout(function(scene){
+ if(aniGroups.length==stopGroups.length){
+ TizenPlay.dom.dispatchEvent(
+ scene.dom.element,
+ TizenPlay.ALL_ANI_GROUP_STOP, {},
+ true, true);
+ }
+ },1,scene);
+ });
+
+ module.exports = TizenPlay;
+});
+
+requirejs.config({
+ //By default load any module IDs from
+ baseUrl : 'tizenplay/libs',
+ //except, if the module ID starts with "app",
+ //load it from the js/app directory. paths
+ //config is relative to the baseUrl, and
+ //never includes a ".js" extension since
+ //the paths config could be for a directory.
+ paths : {
+ app : '../app',
+ proxy : '../proxy'
+ },
+ urlArgs : "bust="+(new Date()).getTime()
+});
+
+var TizenPlay;
+
+(function() {
+
+ require(
+ ['proxy/wub/TizenPlay'],
+ function(_TizenPlay){
+
+ if(typeof ComingBridge!='undefined' &&
+ typeof ComingBridge.printLog =='function' &&
+ typeof console == 'object'){
+
+ console.warn = ComingBridge.printLog;
+ }
+
+ TizenPlay = _TizenPlay;
+ TizenPlay.dom.dispatchEvent(window,
+ TizenPlay.TIZEN_PLAY_READY, TizenPlay, true, true);
+ TizenPlay.init();
+
+ if(typeof tizen_animator_cfg === 'object'){
+
+ TizenPlay.bindTizenEvents(tizen_animator_cfg);
+
+ //TizenPlay.loadPlayModel(tizen_animator_cfg);
+ //TizenPlay.dom.addEvent(window, 'wubReady', function(){
+ // TizenPlay.loadPlayModel(tizen_animator_cfg);
+ //});
+
+ if(typeof tizenPlayIsIDE === 'undefined' || tizenPlayIsIDE === false){
+ var checkDom=null, checkDomCount=0;
+ (function(){
+ checkDom = setInterval(function(){
+ if(TizenPlay.loadPlayModel(tizen_animator_cfg)){
+ clearInterval(checkDom);
+ checkDom = null;
+ }
+ if(checkDom && checkDomCount > 20){
+ clearInterval(checkDom);
+ checkDom = null;
+ console.warn('TizenPlay.loadPlayModel(tizen_animator_cfg) failed');
+ }
+ checkDomCount++;
+ },100);
+ //for safe
+ setTimeout(function(){
+ clearInterval(checkDom);
+ checkDom = null;
+ }, 3000);
+ })();
+ }
+ }
+
+ /*
+ document.addEventListener(
+ TizenPlay.ANI_GROUP_END, function(oEvent){
+
+ });
+ document.addEventListener(
+ TizenPlay.ANI_GROUP_ITERATION, function(oEvent){
+
+ });
+ document.addEventListener(
+ TizenPlay.ANI_GROUP_START, function(oEvent){
+
+ });
+
+ document.addEventListener(
+ TizenPlay.ALL_ANI_GROUP_STOP, function(oEvent){
+
+ });
+
+ TizenPlay.dom.addEvent(document, 'keydown', function(oEvent){
+ if(oEvent.keyCode==49){
+ TizenPlay.playCurrentPage();
+ }else if(oEvent.keyCode==50){
+ TizenPlay.pauseCurrentPage();
+ }else if(oEvent.keyCode==51){
+ TizenPlay.stopCurrentPage();
+
+ }else if(oEvent.keyCode==52){
+ TizenPlay.playPageById('page1');
+ }else if(oEvent.keyCode==53){
+ TizenPlay.pausePageById('page1');
+ }else if(oEvent.keyCode==54){
+ TizenPlay.stopPageById('page1');
+
+ }else if(oEvent.keyCode==55){
+ TizenPlay.playAniGroupsById('page1', ['anim1']);
+ }else if(oEvent.keyCode==56){
+ TizenPlay.pauseAniGroupsById('page1', 'anim1');
+ }else if(oEvent.keyCode==57){
+ TizenPlay.stopAniGroupsById('page1', ['anim2']);
+
+ }else if(oEvent.keyCode==48){
+ TizenPlay.goToStartFrame();
+ }
+ });
+ */
+ }
+ );
-var requirejs,require,define;(function(global){function isFunction(e){return ostring.call(e)==="[object Function]"}function isArray(e){return ostring.call(e)==="[object Array]"}function each(e,t){if(e){var n;for(n=0;n<e.length;n+=1)if(e[n]&&t(e[n],n,e))break}}function eachReverse(e,t){if(e){var n;for(n=e.length-1;n>-1;n-=1)if(e[n]&&t(e[n],n,e))break}}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var n;for(n in e)if(hasProp(e,n)&&t(e[n],n))break}function mixin(e,t,n,r){return t&&eachProp(t,function(t,i){if(n||!hasProp(e,i))r&&typeof t!="string"?(e[i]||(e[i]={}),mixin(e[i],t,n,r)):e[i]=t}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,n,r){var i=new Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return i.requireType=e,i.requireModules=r,n&&(i.originalError=n),i}function newContext(e){function v(e){var t,n;for(t=0;e[t];t+=1){n=e[t];if(n===".")e.splice(t,1),t-=1;else if(n===".."){if(t===1&&(e[2]===".."||e[0]===".."))break;t>0&&(e.splice(t-1,2),t-=2)}}}function m(e,t,n){var r,i,s,u,a,f,l,c,h,p,d,m=t&&t.split("/"),g=m,y=o.map,b=y&&y["*"];e&&e.charAt(0)==="."&&(t?(getOwn(o.pkgs,t)?g=m=[t]:g=m.slice(0,m.length-1),e=g.concat(e.split("/")),v(e),i=getOwn(o.pkgs,r=e[0]),e=e.join("/"),i&&e===r+"/"+i.main&&(e=r)):e.indexOf("./")===0&&(e=e.substring(2)));if(n&&y&&(m||b)){u=e.split("/");for(a=u.length;a>0;a-=1){l=u.slice(0,a).join("/");if(m)for(f=m.length;f>0;f-=1){s=getOwn(y,m.slice(0,f).join("/"));if(s){s=getOwn(s,l);if(s){c=s,h=a;break}}}if(c)break;!p&&b&&getOwn(b,l)&&(p=getOwn(b,l),d=a)}!c&&p&&(c=p,h=d),c&&(u.splice(0,h,c),e=u.join("/"))}return e}function g(e){isBrowser&&each(scripts(),function(t){if(t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===r.contextName)return t.parentNode.removeChild(t),!0})}function y(e){var t=getOwn(o.paths,e);if(t&&isArray(t)&&t.length>1)return g(e),t.shift(),r.require.undef(e),r.require([e]),!0}function b(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 w(e,t,n,i){var s,o,u,a,f=null,l=t?t.name:null,h=e,v=!0,g="";return e||(v=!1,e="_@r"+(p+=1)),a=b(e),f=a[0],e=a[1],f&&(f=m(f,l,i),o=getOwn(c,f)),e&&(f?o&&o.normalize?g=o.normalize(e,function(e){return m(e,l,i)}):g=m(e,l,i):(g=m(e,l,i),a=b(g),f=a[0],g=a[1],n=!0,s=r.nameToUrl(g))),u=f&&!o&&!n?"_unnormalized"+(d+=1):"",{prefix:f,name:g,parentMap:t,unnormalized:!!u,url:s,originalName:h,isDefine:v,id:(f?f+"!"+g:g)+u}}function E(e){var t=e.id,n=getOwn(u,t);return n||(n=u[t]=new r.Module(e)),n}function S(e,t,n){var r=e.id,i=getOwn(u,r);hasProp(c,r)&&(!i||i.defineEmitComplete)?t==="defined"&&n(c[r]):(i=E(e),i.error&&t==="error"?n(i.error):i.on(t,n))}function x(e,t){var n=e.requireModules,r=!1;t?t(e):(each(n,function(t){var n=getOwn(u,t);n&&(n.error=e,n.events.error&&(r=!0,n.emit("error",e)))}),r||req.onError(e))}function T(){globalDefQueue.length&&(apsp.apply(l,[l.length-1,0].concat(globalDefQueue)),globalDefQueue=[])}function N(e){delete u[e],delete a[e]}function C(e,t,n){var r=e.map.id;e.error?e.emit("error",e.error):(t[r]=!0,each(e.depMaps,function(r,i){var s=r.id,o=getOwn(u,s);o&&!e.depMatched[i]&&!n[s]&&(getOwn(t,s)?(e.defineDep(i,c[s]),e.check()):C(o,t,n))}),n[r]=!0)}function k(){var e,n,i,u,f=o.waitSeconds*1e3,l=f&&r.startTime+f<(new Date).getTime(),c=[],h=[],p=!1,d=!0;if(t)return;t=!0,eachProp(a,function(t){e=t.map,n=e.id;if(!t.enabled)return;e.isDefine||h.push(t);if(!t.error)if(!t.inited&&l)y(n)?(u=!0,p=!0):(c.push(n),g(n));else if(!t.inited&&t.fetched&&e.isDefine){p=!0;if(!e.prefix)return d=!1}});if(l&&c.length)return i=makeError("timeout","Load timeout for modules: "+c,null,c),i.contextName=r.contextName,x(i);d&&each(h,function(e){C(e,{},{})}),(!l||u)&&p&&(isBrowser||isWebWorker)&&!s&&(s=setTimeout(function(){s=0,k()},50)),t=!1}function L(e){hasProp(c,e[0])||E(w(e[0],null,!0)).init(e[1],e[2])}function A(e,t,n,r){e.detachEvent&&!isOpera?r&&e.detachEvent(r,t):e.removeEventListener(n,t,!1)}function O(e){var t=e.currentTarget||e.srcElement;return A(t,r.onScriptLoad,"load","onreadystatechange"),A(t,r.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function M(){var e;T();while(l.length){e=l.shift();if(e[0]===null)return x(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));L(e)}}var t,n,r,i,s,o={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{},config:{}},u={},a={},f={},l=[],c={},h={},p=1,d=1;return i={require:function(e){return e.require?e.require:e.require=r.makeRequire(e.map)},exports:function(e){e.usingExports=!0;if(e.map.isDefine)return e.exports?e.exports:e.exports=c[e.map.id]={}},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){var t,n=getOwn(o.pkgs,e.map.id);return t=n?getOwn(o.config,e.map.id+"/"+n.main):getOwn(o.config,e.map.id),t||{}},exports:c[e.map.id]}}},n=function(e){this.events=getOwn(f,e.id)||{},this.map=e,this.shim=getOwn(o.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},n.prototype={init:function(e,t,n,r){r=r||{};if(this.inited)return;this.factory=t,n?this.on("error",n):this.events.error&&(n=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=r.ignore,r.enabled||this.enabled?this.enable():this.check()},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(this.fetched)return;this.fetched=!0,r.startTime=(new Date).getTime();var e=this.map;if(!this.shim)return e.prefix?this.callPlugin():this.load();r.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()}))},load:function(){var e=this.map.url;h[e]||(h[e]=!0,r.load(this.map.id,e))},check:function(){if(!this.enabled||this.enabling)return;var e,t,n=this.map.id,i=this.depExports,s=this.exports,o=this.factory;if(!this.inited)this.fetch();else if(this.error)this.emit("error",this.error);else if(!this.defining){this.defining=!0;if(this.depCount<1&&!this.defined){if(isFunction(o)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{s=r.execCb(n,o,i,s)}catch(u){e=u}else s=r.execCb(n,o,i,s);this.map.isDefine&&(t=this.module,t&&t.exports!==undefined&&t.exports!==this.exports?s=t.exports:s===undefined&&this.usingExports&&(s=this.exports));if(e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",x(this.error=e)}else s=o;this.exports=s,this.map.isDefine&&!this.ignore&&(c[n]=s,req.onResourceLoad&&req.onResourceLoad(r,this.map,this.depMaps)),N(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}},callPlugin:function(){var e=this.map,t=e.id,n=w(e.prefix);this.depMaps.push(n),S(n,"defined",bind(this,function(n){var i,s,a,f=this.map.name,l=this.map.parentMap?this.map.parentMap.name:null,c=r.makeRequire(e.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){n.normalize&&(f=n.normalize(f,function(e){return m(e,l,!0)})||""),s=w(e.prefix+"!"+f,this.map.parentMap),S(s,"defined",bind(this,function(e){this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),a=getOwn(u,s.id),a&&(this.depMaps.push(s),this.events.error&&a.on("error",bind(this,function(e){this.emit("error",e)})),a.enable());return}i=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),i.error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(u,function(e){e.map.id.indexOf(t+"_unnormalized")===0&&N(e.map.id)}),x(e)}),i.fromText=bind(this,function(n,s){var u=e.name,a=w(u),f=useInteractive;s&&(n=s),f&&(useInteractive=!1),E(a),hasProp(o.config,t)&&(o.config[u]=o.config[t]);try{req.exec(n)}catch(l){return x(makeError("fromtexteval","fromText eval for "+t+" failed: "+l,l,[t]))}f&&(useInteractive=!0),this.depMaps.push(a),r.completeLoad(u),c([u],i)}),n.load(e.name,c,i,o)})),r.enable(n,this),this.pluginMaps[n.id]=n},enable:function(){a[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var n,s,o;if(typeof e=="string"){e=w(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,o=getOwn(i,e.id);if(o){this.depExports[t]=o(this);return}this.depCount+=1,S(e,"defined",bind(this,function(e){this.defineDep(t,e),this.check()})),this.errback&&S(e,"error",bind(this,this.errback))}n=e.id,s=u[n],!hasProp(i,n)&&s&&!s.enabled&&r.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(u,e.id);t&&!t.enabled&&r.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var n=this.events[e];n||(n=this.events[e]=[]),n.push(t)},emit:function(e,t){each(this.events[e],function(e){e(t)}),e==="error"&&delete this.events[e]}},r={config:o,contextName:e,registry:u,defined:c,urlFetched:h,defQueue:l,Module:n,makeModuleMap:w,nextTick:req.nextTick,onError:x,configure:function(e){e.baseUrl&&e.baseUrl.charAt(e.baseUrl.length-1)!=="/"&&(e.baseUrl+="/");var t=o.pkgs,n=o.shim,i={paths:!0,config:!0,map:!0};eachProp(e,function(e,t){i[t]?t==="map"?(o.map||(o.map={}),mixin(o[t],e,!0,!0)):mixin(o[t],e,!0):o[t]=e}),e.shim&&(eachProp(e.shim,function(e,t){isArray(e)&&(e={deps:e}),(e.exports||e.init)&&!e.exportsFn&&(e.exportsFn=r.makeShimExports(e)),n[t]=e}),o.shim=n),e.packages&&(each(e.packages,function(e){var n;e=typeof e=="string"?{name:e}:e,n=e.location,t[e.name]={name:e.name,location:n||e.name,main:(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}}),o.pkgs=t),eachProp(u,function(e,t){!e.inited&&!e.map.unnormalized&&(e.map=w(t))}),(e.deps||e.callback)&&r.require(e.deps||[],e.callback)},makeShimExports:function(e){function t(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||e.exports&&getGlobal(e.exports)}return t},makeRequire:function(t,n){function s(o,a,f){var l,h,p;return n.enableBuildCallback&&a&&isFunction(a)&&(a.__requireJsBuild=!0),typeof o=="string"?isFunction(a)?x(makeError("requireargs","Invalid require call"),f):t&&hasProp(i,o)?i[o](u[t.id]):req.get?req.get(r,o,t,s):(h=w(o,t,!1,!0),l=h.id,hasProp(c,l)?c[l]:x(makeError("notloaded",'Module name "'+l+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(M(),r.nextTick(function(){M(),p=E(w(null,t)),p.skipMap=n.skipMap,p.init(o,a,f,{enabled:!0}),k()}),s)}return n=n||{},mixin(s,{isBrowser:isBrowser,toUrl:function(e){var n,i=e.lastIndexOf("."),s=e.split("/")[0],o=s==="."||s==="..";return i!==-1&&(!o||i>1)&&(n=e.substring(i,e.length),e=e.substring(0,i)),r.nameToUrl(m(e,t&&t.id,!0),n,!0)},defined:function(e){return hasProp(c,w(e,t,!1,!0).id)},specified:function(e){return e=w(e,t,!1,!0).id,hasProp(c,e)||hasProp(u,e)}}),t||(s.undef=function(e){T();var n=w(e,t,!0),r=getOwn(u,e);delete c[e],delete h[n.url],delete f[e],r&&(r.events.defined&&(f[e]=r.events),N(e))}),s},enable:function(e){var t=getOwn(u,e.id);t&&E(e).enable()},completeLoad:function(e){var t,n,r,i=getOwn(o.shim,e)||{},s=i.exports;T();while(l.length){n=l.shift();if(n[0]===null){n[0]=e;if(t)break;t=!0}else n[0]===e&&(t=!0);L(n)}r=getOwn(u,e);if(!t&&!hasProp(c,e)&&r&&!r.inited){if(o.enforceDefine&&(!s||!getGlobal(s))){if(y(e))return;return x(makeError("nodefine","No define call for "+e,null,[e]))}L([e,i.deps||[],i.exportsFn])}k()},nameToUrl:function(e,t,n){var r,i,s,u,a,f,l,c,h;if(req.jsExtRegExp.test(e))c=e+(t||"");else{r=o.paths,i=o.pkgs,a=e.split("/");for(f=a.length;f>0;f-=1){l=a.slice(0,f).join("/"),s=getOwn(i,l),h=getOwn(r,l);if(h){isArray(h)&&(h=h[0]),a.splice(0,f,h);break}if(s){e===s.name?u=s.location+"/"+s.main:u=s.location,a.splice(0,f,u);break}}c=a.join("/"),c+=t||(/\?/.test(c)||n?"":".js"),c=(c.charAt(0)==="/"||c.match(/^[\w\+\.\-]+:/)?"":o.baseUrl)+c}return o.urlArgs?c+((c.indexOf("?")===-1?"?":"&")+o.urlArgs):c},load:function(e,t){req.load(r,e,t)},execCb:function(e,t,n,r){return t.apply(r,n)},onScriptLoad:function(e){if(e.type==="load"||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=O(e);r.completeLoad(t.id)}},onScriptError:function(e){var t=O(e);if(!y(t.id))return x(makeError("scripterror","Script error for: "+t.id,e,[t.id]))}},r.require=r.makeRequire(),r}function getInteractiveScript(){return interactiveScript&&interactiveScript.readyState==="interactive"?interactiveScript:(eachReverse(scripts(),function(e){if(e.readyState==="interactive")return interactiveScript=e}),interactiveScript)}var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.1.8",commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,ap=Array.prototype,apsp=ap.splice,isBrowser=typeof window!="undefined"&&!!navigator&&!!window.document,isWebWorker=!isBrowser&&typeof importScripts!="undefined",readyRegExp=isBrowser&&navigator.platform==="PLAYSTATION 3"?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera=typeof opera!="undefined"&&opera.toString()==="[object Opera]",contexts={},cfg={},globalDefQueue=[],useInteractive=!1;if(typeof define!="undefined")return;if(typeof requirejs!="undefined"){if(isFunction(requirejs))return;cfg=requirejs,requirejs=undefined}typeof require!="undefined"&&!isFunction(require)&&(cfg=require,require=undefined),req=requirejs=function(e,t,n,r){var i,s,o=defContextName;return!isArray(e)&&typeof e!="string"&&(s=e,isArray(t)?(e=t,t=n,n=r):e=[]),s&&s.context&&(o=s.context),i=getOwn(contexts,o),i||(i=contexts[o]=req.s.newContext(o)),s&&i.configure(s),i.require(e,t,n)},req.config=function(e){return req(e)},req.nextTick=typeof setTimeout!="undefined"?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(e){req[e]=function(){var t=contexts[defContextName];return t.require[e].apply(t,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(e,t,n){var r=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return r.type=e.scriptType||"text/javascript",r.charset="utf-8",r.async=!0,r},req.load=function(e,t,n){var r=e&&e.config||{},i;if(isBrowser)return i=req.createNode(r,t,n),i.setAttribute("data-requirecontext",e.contextName),i.setAttribute("data-requiremodule",t),i.attachEvent&&!(i.attachEvent.toString&&i.attachEvent.toString().indexOf("[native code")<0)&&!isOpera?(useInteractive=!0,i.attachEvent("onreadystatechange",e.onScriptLoad)):(i.addEventListener("load",e.onScriptLoad,!1),i.addEventListener("error",e.onScriptError,!1)),i.src=n,currentlyAddingScript=i,baseElement?head.insertBefore(i,baseElement):head.appendChild(i),currentlyAddingScript=null,i;if(isWebWorker)try{importScripts(n),e.completeLoad(t)}catch(s){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+n,s,[t]))}},isBrowser&&eachReverse(scripts(),function(e){head||(head=e.parentNode),dataMain=e.getAttribute("data-main");if(dataMain)return mainScript=dataMain,cfg.baseUrl||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0}),define=function(e,t,n){var r,i;typeof e!="string"&&(n=t,t=e,e=null),isArray(t)||(n=t,t=null),!t&&isFunction(n)&&(t=[],n.length&&(n.toString().replace(commentRegExp,"").replace(cjsRequireRegExp,function(e,n){t.push(n)}),t=(n.length===1?["require"]:["require","exports","module"]).concat(t))),useInteractive&&(r=currentlyAddingScript||getInteractiveScript(),r&&(e||(e=r.getAttribute("data-requiremodule")),i=contexts[r.getAttribute("data-requirecontext")])),(i?i.defQueue:globalDefQueue).push([e,t,n])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)})(this),define("requireLib",function(){}),define("common/util",["require","exports","module"],function(e,t,n){var r=function(){},i=function(e){s.defineProperty(this,"_protoOf",{value:e})},s={is:function(e,t){return{}.toString.call(e)==="[object "+t+"]"},defineProperty:function(e,t,n){typeof Object.defineProperty=="function"?Object.defineProperty(e,t,n):e[t]=n.value},copyOwnProperties:function(e,t){if(e instanceof Object){var n;for(n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}},Class:function(e){var t=e.dynamics||{},n=e.statics||{};t.init=e.init||r;var o=function(){s.defineProperty(this,"_type",{value:e.name||""}),o.prototype.hasOwnProperty("init")&&o.prototype.init.apply(this,arguments)},u=e.extend||Object;return i.prototype=u.prototype,o.prototype=new i(e.name),this.defineProperty(o.prototype,"constructor",{value:o}),this.copyOwnProperties(u,o),this.defineProperty(o,"super",{value:u.prototype}),this.copyOwnProperties(t,o.prototype),this.copyOwnProperties(n,o),o},Interface:function(e){}};n.exports=s}),define("common/string",["require","exports","module"],function(e,t,n){n.exports={trim:function(e){return e.replace(/^\s+|\s+$/g,"")},ucFirst:function(e){return e.substr(0,1).toUpperCase()+e.substr(1)},getRandomColor:function(){var e="0123456789ABCDEF".split(""),t="#";for(var n=0;n<6;n++)t+=e[Math.round(Math.random()*15)];return t},round:function(e,t){console.log("in --> "+e);var n=Math.pow(10,t);return console.log("power = "+n),Math.round(parseFloat(e)*n)/n}}}),define("bases/Registry",["require","exports","module"],function(e,t,n){var r={};n.exports={getRegistry:function(){return r},registerByType:function(e,t,n){var i;typeof r[e]=="undefined"&&(r[e]={}),r[e][t.id]=t,(i=n.constructor.super)&&i._protoOf&&this.registerByType(i._protoOf,t,i)},register:function(e){e.id&&this.registerByType(e._type,e,e)},getObjectById:function(e,t){var n;return t?(n=r[t][e],n||console.log(e+" is not found in the Registry.")):(n=r.BaseObject[e],n||console.log(e+"@"+t+" is not found in the Registry.")),n}}}),define("bases/BaseObject",["require","exports","module","common/util","common/string","bases/Registry"],function(e,t,n){var r=e("common/util"),i=e("common/string"),s=e("bases/Registry"),o=0,u=function(e,t){if(!(t in e))throw new Error(t+" property does not exists")},a=r.Class({name:"BaseObject",extend:Object,init:function(e){r.defineProperty(this,"_uid",{value:++o}),typeof e=="object"&&(r.defineProperty(this,"id",{value:e.id||null}),s.register(this))},dynamics:{get:function(e){u(this,e);var t="get"+i.ucFirst(e);return this[t]?this[t]():this[e]},set:function(e,t){u(this,e);var n="set"+i.ucFirst(e);this[n]?this[n](t):this[e]=t},setAssoc:function(e,t,n){var r=this.get(e);if(typeof r!="object")throw new Error(e+" property value is not object");r[t]=n,this.set(e,r)}},statics:{create:function(e){return new this(e)},getType:function(){return(new this)._type},isEmpty:function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0}}});n.exports=a}),define("common/dom",["require","exports","module","common/string"],function(e,t,n){var r=e("common/string");n.exports={byId:function(e){return document.getElementById(e)},byTag:function(e){return document.getElementsByTagName(e)},bySelector:function(e,t){return t=t||document,t.querySelectorAll(e)},getAppliedStyleClone:function(e){var t,n=new Object;for(t in e.style)n[t]=e.style[t];return n},getComputedStyleClone:function(e){var t=window.getComputedStyle(e),n=t.length,r,i,s={};for(r=0;r<n;r++)i=t[r],s[i]=t[i];return s},getComputedStyleDiff:function(e,t){var n,r={};for(n in e)e[n]!=t[n]&&(r[n]=t[n]);return r},checkComputedStyleDiff:function(e,t){var n,r=!1,i=this.getComputedStyleDiff(e,t);for(n in i)r=!0;return r},getStyle:function(e,t){var n=window.getComputedStyle(e);return n[t]},setStyles:function(e,t){var n;for(n in t)e.style[n]=t[n]},makeElement:function(e,t,n,r){typeof r=="undefined"&&(r=window);var i=r.document.createElement(e);r.document.body.appendChild(i);if(t)for(var s in t)i[s]=t[s];return n?this.addElement(i,n.element,n.position):r.document.body.appendChild(i),i},addElement:function(e,t,n){n=="after"||n==undefined?t.parentNode.insertBefore(e,t.nextSibling):n=="before"?t.parentNode.insertBefore(e,t):n=="inside"&&t.appendChild(e)},nodeType:{1:"ELEMENT_NODE",2:"ATTRIBUTE_NODE",3:"TEXT_NODE",4:"CDATA_SECTION_NODE",5:"ENTITY_REFERENCE_NODE",6:"ENTITY_NODE",7:"PROCESSING_INSTRUCTION_NODE",8:"COMMENT_NODE",9:"DOCUMENT_NODE",10:"DOCUMENT_TYPE_NODE",11:"DOCUMENT_FRAGMENT_NODE",12:"NOTATION_NODE"},prepareNode:function(){if(typeof window.Node=="undefined")for(i in this.nodeType)window.Node[this.nodeType[i]]=i},cloneNode:function(e,t){var n;switch(e.nodeType){case Node.ELEMENT_NODE:n=document.createElement(e.nodeName),n.id=e.id,n.className=e.className,this.setStyles(n,this.getComputedStyleClone(e));break;case Node.TEXT_NODE:n=document.createTextNode(e.nodeValue);break;default:}return n},shadowNode:function(e,t){this.prepareNode();var n=this.cloneNode(e,!1);switch(e.nodeType){case Node.ELEMENT_NODE:this.setStyles(n,{visibility:"hidden"}),n.id&&(n.id="clone_"+n.id);if(e.hasChildNodes()){var r;for(r=e.firstChild;r!=null;r=r.nextSibling)n.appendChild(this.shadowNode(r,t))}break;case Node.TEXT_NODE:break;default:console.log("default")}return n},cloneElement:function(e,t){console.log("cloneElement("+e.id+")");var n,r,i,s={id:"clone_"+e.id},o=this.makeElement(e.nodeName,s,{element:e,position:t||"after"});return o.innerHTML=s.id,o},addEvent:function(e,t,n){return e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n),n},removeEvent:function(e,t,n){e.addEventListener?e.removeEventListener(t,n,!1):e.detachEvent("on"+t,n)},createEvent:function(e,t,n,r,i){var s=document.createEvent("Events");s.initEvent(e,n,r),i||(s.bundle={});if(t)for(var o in t)t.hasOwnProperty(o)&&(i?s[o]=t[o]:s.bundle[o]=t[o]);return s},dispatchEvent:function(e,t,n,r,i,s){var o=e.id?":"+e.id:"";t!="aniGroupTimeUpdate"&&console.log("%c\r\n <==== dispatchEvent("+e.toString().replace("object ","")+o+", '"+t+"')","color:orange"),e.fireEvent?e.fireEvent("on"+t):e.dispatchEvent&&e.dispatchEvent(this.createEvent(t,n,r,i,s))},hide:function(e){var t=this.byId(e);t&&(t.style.display="none")},getAbsPos:function(e,t){var n=0;while(e.offsetParent)n+=e["offset"+t],e=e.offsetParent;return n}}}),define("common/css",["require","exports","module","common/string"],function(e,t,n){var r=e("common/string"),i={propPrefix:"webkit",eventPrefix:"webkit",inlinePrefix:"-webkit-",detectPrexfix:function(){console.log("css.detectPrexfix()");if(document.body){var e=document.body.style;e["webkitAnimation"]!=undefined?(this.propPrefix="webkit",this.eventPrefix="webkit",this.inlinePrefix="-webkit-"):e["MozAnimation"]!=undefined?(this.propPrefix="Moz",this.eventPrefix="",this.inlinePrefix=""):e["animation"]!=undefined&&(this.propPrefix="",this.eventPrefix="",this.inlinePrefix="")}console.log("this.propPrefix = "+this.propPrefix),console.log("this.inlinePrefix = "+this.inlinePrefix)},fixProp:function(e){return this.propPrefix&&(e=this.propPrefix+r.ucFirst(e)),e},fixInline:function(e){return this.inlinePrefix&&(e=this.inlinePrefix+e),e},fixEvent:function(e){return this.eventPrefix?e=this.eventPrefix+r.ucFirst(e):e=e.toLowerCase(),e},insertRule:function(e,t,n,r){console.log("css.insertRule(styleSheet,"+t+","+n+",pos)");if(e.insertRule)e.insertRule(t+"{"+n+"}",r);else{if(!e.addRule)throw new Error("insertRule() not supported");e.addRule(t,n,r)}},setAnimation:function(e,t){console.log("css.setAnimation("+e.id+",prop)"),e.style[this.fixProp("animationName")]=t.name,e.style[this.fixProp("animationDelay")]=t.delay,e.style[this.fixProp("animationFillMode")]=t.fillmode,e.style[this.fixProp("animationDuration")]=t.duration,e.style[this.fixProp("animationDirection")]=t.direction,e.style[this.fixProp("animationTimingFunction")]=t.timing,e.style[this.fixProp("animationIterationCount")]=t.iteration,e.style[this.fixProp("animationPlayState")]="running"},resetAnimation1:function(e){console.log("css.resetAnimation("+e.id+")");try{delete e.style[this.fixProp("animation")],delete e.style[this.fixProp("animationName")],delete e.style[this.fixProp("animationDelay")],delete e.style[this.fixProp("animationFillMode")],delete e.style[this.fixProp("animationDuration")],delete e.style[this.fixProp("animationDirection")],delete e.style[this.fixProp("animationTimingFunction")],delete e.style[this.fixProp("animationIterationCount")]}catch(t){console.log(t.message)}},resetAnimation:function(e){console.log("css.resetAnimation("+e.id+")");var t=e.style;try{delete t[this.fixProp("animation")],delete t[this.fixProp("animationName")],delete t[this.fixProp("animationDelay")],delete t[this.fixProp("animationFillMode")],delete t[this.fixProp("animationDuration")],delete t[this.fixProp("animationDirection")],delete t[this.fixProp("animationTimingFunction")],delete t[this.fixProp("animationIterationCount")],t[this.fixProp("animation")]="",t[this.fixProp("animationName")]="",t[this.fixProp("animationDelay")]="",t[this.fixProp("animationFillMode")]="",t[this.fixProp("animationDuration")]="",t[this.fixProp("animationDirection")]="",t[this.fixProp("animationTimingFunction")]="",t[this.fixProp("animationIterationCount")]="",t[this.fixProp("animationPlayState")]=""}catch(n){console.log(n.message)}}};i.detectPrexfix(),n.exports=i}),define("common/env",["require","exports","module","common/css"],function(e,t,n){var r=e("common/css");n.exports={agent:null,useJQuery:!1,init:function(e){console.log("env.init()"),this.detectAgent(),this.setJQuery(e.useJQuery)},setJQuery:function(e){typeof jQuery!="undefined"&&e&&(this.useJQuery=!0)},detectAgent:function(){console.log("env.detectAgent()");var e=window.navigator.userAgent;console.log("userAgent = "+e),/ Qt/ig.test(e)?this.agent="qt":/ OPR/ig.test(e)?this.agent="opera":/ Chrome/ig.test(e)?this.agent="chrome":/ Safari/ig.test(e)?this.agent="safari":/ Firefox/ig.test(e)?this.agent="firefox":/ MSIE/ig.test(e)&&(this.agent="ie"),console.log("env.agent = "+this.agent)}}}),define("events/Event",["require","exports","module","common/util","common/env","common/dom","bases/Registry","bases/BaseObject"],function(e,t,n){var r=e("common/util"),i=e("common/env"),s=e("common/dom"),o=e("bases/Registry"),u=e("bases/BaseObject"),a=r.Class({name:"Event",extend:u,init:function(e){a.super.init.apply(this,arguments)},dynamics:{},statics:{create:function(e){return i.useJQuery||s.addEvent(e.element,e.eventName,function(t){console.log(e.type,e.target,e.act);if(e.type==="AniGroup"){var n=o.getObjectById(e.target,"AniGroup");n[e.act]()}}),new this(e)}}});n.exports=a}),define("dom/Dom",["require","exports","module","common/util","common/dom","common/string","bases/BaseObject","events/Event"],function(e,t,n){var r=e("common/util"),i=e("common/dom"),s=e("common/string"),o=e("bases/BaseObject"),u=e("events/Event"),a=r.Class({name:"Dom",extend:o,init:function(e,t){a.super.init.apply(this,arguments),this.set("element",i.byId(t)),this.set("style",this.element.style),this.set("events",new Object);if(e.events){var n,r,s;for(n in e.events){this.events[n]||(this.events[n]=new Array),r=e.events[n];for(s=0;s<r.length;s++)this.events[n].push(u.create({id:r[s].id,element:this.element,eventName:n,type:r[s].type,target:r[s].target,act:r[s].act}))}}},dynamics:{style:null,element:null,events:null},statics:{create:function(e){if(e.id&&i.byId(e.id)){var t=e.id,n,r=new Object;for(n in e)r[n]=e[n];return r.id="dom"+s.ucFirst(r.id),new this(r,t)}}}});n.exports=a}),define("nodes/Node",["require","exports","module","common/util","common/dom","bases/BaseObject","dom/Dom"],function(e,t,n){var r=e("common/util"),i=e("common/dom"),s=e("bases/BaseObject"),o=e("dom/Dom"),u=r.Class({name:"Node",extend:s,init:function(e){u.super.init.apply(this,arguments),this.set("children",new Array),this.set("dom",o.create(e))},dynamics:{parent:null,children:null,dom:null,visible:!0,addChild:function(e){return this.children.push(e),e.set("parent",this),this},hasChildren:function(){return this.children.length>0},hasParent:function(){return this.parent instanceof this.constructor},getChildById:function(e){var t;for(t in this.children)if(this.children[t].id===e)return this.children[t]},runAction:function(e){e.runWith(this)},pauseAction:function(e){e.pauseWith(this)},resumeAction:function(e){e.resumeWith(this)},stopAction:function(e){e.stopWith(this)},setVisible:function(e){this.visible=e;if(this.dom){var t=this.dom.style;t.visibility=e?"visible":"hidden"}}},statics:{}});n.exports=u}),define("common/logger",["require","exports","module"],function(e,t,n){n.exports={log:function(){console.log.apply(console,arguments)},event:function(e){this.log("%c ====> "+e+"\r\n","color:#4CC552")},check:function(e,t){var n="";t?t+=".":t="";for(var r in e)n+=" "+t+r+" = "+e[r]+"\n"}}}),define("bases/Timer",["require","exports","module"],function(e,t,n){var r=0,i={};n.exports={getTimer:function(e){return i[e]},repeat:function(e){var t=e.onRepeat||function(){},n=e.duration||1e3,s=e.iteration||1,o=e.immediately||!0,u=e.onEnd||function(){},a=e.bundle||{},f=i[++r]={id:null,type:"repeat",duration:n,iteration:s,step:0,paused:!1,startMs:0,progress:0,bundle:a,onRepeat:t,onEnd:u};return o&&(++f.step,f.startMs=(new Date).getTime(),t(a)),f.id=setInterval(function(e){++f.step<=f.iteration?(f.startMs=(new Date).getTime(),t(e)):(u(e),clearInterval(f.id))},f.duration,a),r},setInterval:function(e,t){return i[++r]={type:"interval",id:setInterval(e,t)},r},setTimeout:function(e,t){return i[++r]={type:"interval",id:setTimeout(e,t)},r},pause:function(e){var t=i[e],n=t.type;switch(n){case"interval":break;case"timeout":break;case"repeat":var r=(new Date).getTime()-t.startMs;t.progress=r/t.duration,t.paused=!0,clearInterval(t.id),clearInterval(t.timeout)}},resume:function(e,t){var n=i[e],r=n.type;switch(r){case"interval":break;case"timeout":break;case"repeat":n.paused=!1,console.log(n),t(),++n.step;var s=(1-n.progress)*n.duration;n.timeout=setTimeout(function(e){var t=e.onRepeat,n=e.onEnd,r=e.bundle;e.startMs=(new Date).getTime(),t(r),e.id=setInterval(function(r){++e.step<=e.iteration?(e.startMs=(new Date).getTime(),t(r)):(n(r),clearInterval(e.id))},e.duration,r)},s,n)}},clear:function(e){var t=i[e],n=t.type;switch(n){case"interval":clearInterval(t.id);break;case"timeout":clearTimeout(t.id);break;case"repeat":clearInterval(t.id)}},sleep:function(e){var t=(new Date).getTime();while((new Date).getTime()<t+e);}}}),define("actions/Action",["require","exports","module","common/util","bases/BaseObject"],function(e,t,n){var r=e("common/util"),i=e("bases/BaseObject"),s=r.Class({name:"Action",extend:i,init:function(e){s.super.init.apply(this,arguments)},dynamics:{target:null,state:"stop",runWith:function(e){this.set("target",e),this.set("state","run")},pauseWith:function(e){this.get("state")==="run"&&this.set("state","pause")},resumeWith:function(e){this.get("state")==="pause"&&this.set("state","run")},stopWith:function(e){this.set("target",null),this.set("state","stop")}},statics:{}});n.exports=s}),define("actions/Animate",["require","exports","module","common/util","common/env","common/logger","common/string","common/dom","common/css","bases/Registry","actions/Action"],function(e,t,n){var r=e("common/util"),i=e("common/env"),s=e("common/logger"),o=e("common/string"),u=e("common/dom"),a=e("common/css"),f=e("bases/Registry"),l=e("actions/Action"),c=10;a.inlinePrefix.length&&(c=10+a.inlinePrefix.length),console.log("subLen = "+c);var h=r.Class({name:"Animate",extend:l,init:function(e){h.super.init.apply(this,arguments),this.set("delay",e.delay||"0s"),this.set("duration",e.duration||"0s"),this.set("iteration",e.iteration||1),this.iteration==="infinite"&&(this.iteration=Number.MAX_VALUE/1e7),this.set("direction",e.direction||"normal"),this.set("fillmode",e.fillmode||"forwards"),this.set("timing",e.timing||"ease"),e.justplay===!0?this.set("justplay",!0):this.set("justplay",!1),this.set("holdEnd",e.holdEnd||!1),this.set("handlers",{start:function(){},iteration:function(){},end:function(){},resumeTime:function(){}}),e.handlers&&(typeof e.handlers.start=="function"&&this.setAssoc("handlers","start",e.handlers.start),typeof e.handlers.iteration=="function"&&this.setAssoc("handlers","iteration",e.handlers.iteration),typeof e.handlers.end=="function"&&this.setAssoc("handlers","end",e.handlers.end),typeof e.handlers.resumeTime=="function"&&this.setAssoc("handlers","resumeTime",e.handlers.resumeTime)),this.set("delayRemain",parseFloat(this.delay)*1e3),this.set("totalDuration",parseFloat(this.duration)*this.iteration*1e3),this.set("currentTime",-1*this.delayRemain)},dynamics:{delay:null,duration:null,iteration:null,direction:null,fillmode:null,timing:null,justplay:null,handlers:null,holdEnd:null,iterated:0,beforeCss:null,originCss:null,startCss:null,endCss:null,startMs:0,delayRemain:null,currentTime:0,timelineState:0,totalDuration:0,noMove:!1,bindAnimation:function(e,t){console.log("<Animate> "+this.id+".bindAnimation("+e.id+", prop)"),t.name=t.id,a.setAnimation(e,t),this.updateStartMs()},unbindAnimation:function(){console.log("<Animate> "+this.id+".unbindAnimation()");if(this.target){var e=this.target.dom.element,t=u.byId("clone_"+e.id);a.resetAnimation(e),a.resetAnimation(t)}},updateStartMs:function(){this.set("startMs",(new Date).getTime())},runWithDelay:function(e,t){console.log("%c<Animate> "+this.id+".runWithDelay("+e.id+", "+t+")","color:red"),this.bindAnimation(e,{id:this.id,delay:t/1e3+"s",fillmode:this.fillmode,duration:this.duration,direction:this.direction,timing:this.timing,iteration:this.iteration,playState:"running"})},setStartPos:function(e){console.log("<Animate> "+this.id+".setStartPos("+e.id+")"),this.endCss&&(this.beforeCss=this.endCss),this.startCss&&this.setStyleByDiff(e.dom.element,this.startCss)},runWith:function(e){console.log("<Animate> "+this.id+".runWith("+e.id+")"),this.setStartPos(e),this.unbindAnimation(),this.resetStates(),console.log("this.target",this.target),console.log(e.dom.element.style[a.fixProp("animationName")]),this.target&&this.target._uid===e._uid&&this.stopWith(this.target),setTimeout(function(e,t,n){h.super.runWith.apply(e,t),e.bindAnimation(n.dom.element,e)},1,this,arguments,e)},pauseWith:function(e){console.log("<Animate> "+this.id+".pauseWith("+e.id+")");var t=e.dom.style;if(t[a.fixProp("animationName")]&&this.state==="run"){h.super.pauseWith.apply(this,arguments);if(this.delayRemain>0){var n=(new Date).getTime()-this.startMs;this.set("delayRemain",this.delayRemain-n),console.log(" @@ delta = "+n),console.log(" @@ this.delayRemain = "+this.delayRemain)}if(this.delayRemain>0){var r=" @@ delayed : this.id = "+this.id+", ";r+="this.target.id = "+this.target.id+", ",r+="style[css.fixProp('animationDelay')] = "+t[a.fixProp("animationDelay")],console.log(r),this.unbindAnimation()}else t[a.fixProp("animationPlayState")]="paused"}},resumeWith:function(e){console.log("resumeWith("+e.id+")");var t=e.dom.style;this.set("timelineState",0),t[a.fixProp("animationName")]&&this.state==="pause"&&(h.super.resumeWith.apply(this,arguments),t[a.fixProp("animationPlayState")]="running"),this.delayRemain>0&&this.state==="pause"&&(console.log(" @@ this.state = "+this.state),h.super.resumeWith.apply(this,arguments),this.runWithDelay(e.dom.element,this.delayRemain))},resetStates:function(){console.log("<Animate> "+this.id+".resetStates()"),this.set("startMs",0),this.set("timelineState",0),this.set("iterated",0),this.set("delayRemain",parseFloat(this.delay)*1e3),this.set("currentTime",-1*this.delayRemain)},stopWith:function(e){console.log("<Animate> "+this.id+".stopWith("+e.id+")"),console.log("this.holdEnd = "+this.holdEnd),this.holdEnd===!0&&this.target&&(this.detectEndCss(),this.beforeCss=this.startCss,this.setStyleByDiff(this.target.dom.element,this.endCss,!0)),this.unbindAnimation(),this.resetStates(),h.super.stopWith.apply(this,arguments)},detectStyleWith:function(e){console.log("\r\n<Animate> "+this.id+".detectStyleWith("+e.id+")"),this.detectOriginCss(e),setTimeout(function(e,t){e.detectStartCss(t)},1,this,e)},detectOriginCss:function(e){console.log("%c<Animate> "+this.id+".detectOriginCss("+e.id+")","color:#56A5EC");var t=e.dom.element,n=h.getCloneStyle(t);this.set("originCss",n),console.log(this.id+".originCss['-webkit-transform'] = "+this.originCss["-webkit-transform"]),console.log(s.check(this.originCss,this.id+".originCss"))},detectStartCss_old:function(e){console.log("<Animate> "+this.id+".detectStartCss("+e.id+")");var t=e.dom.element,n=u.byId("clone_"+t.id);this.set("timelineState",h.IS_DETECT_START),this.set("target",e),this.runWithDelay(n,0)},detectStartCss:function(e){console.log("%c\r\n<Animate> "+this.id+".detectStartCss("+e.id+")","color:#56A5EC");var t=e.dom.element,n=u.byId("clone_"+t.id);this.bindAnimation(n,{id:this.id,delay:"0s",fillmode:this.fillmode,duration:this.duration,direction:this.direction,timing:this.timing,iteration:this.iteration,playState:"pause"});var r=h.getCloneStyle(n);this.set("startCss",r),console.log(this.id+".startCss['-webkit-transform'] = "+this.startCss["-webkit-transform"]),console.log(s.check(this.startCss,this.id+".startCss")),setTimeout(function(e,t,n){a.resetAnimation(e),u.dispatchEvent(t.dom.element,h.DETECT_START_CSS,{animate:n,node:t},!0,!0)},0,n,e,this)},detectEndCss:function(){console.log("%c\r\n<Animate> "+this.id+".detectEndCss()","color:#56A5EC"),this.target!=null&&(this.set("endCss",h.getCloneStyle(this.target.dom.element)),console.log(this.id+".endCss['-webkit-transform'] = "+this.endCss["-webkit-transform"]),console.log(s.check(this.endCss,this.id+".endCss")))},setStyleByDiff:function(e,t,n){console.log("<Animate> "+this.id+".setStyleByDiff("+e.id+",style)"),this.beforeCss==null&&(this.beforeCss=this.originCss);var r=u.getComputedStyleDiff(this.beforeCss,t);console.log(s.check(r,"diff")),u.setStyles(e,r),this.beforeCss=t,h.dispatchSetTimeEvent(e,"#"+e.id,this.currentTime,this)},goToStartFrameWith:function(e){console.log("%c<Animate> "+this.id+".goToStartFrameWith("+e.id+")","color:#4EE2EC");var t=e.dom.element;this.stopWith(e),this.setStyleByDiff(t,this.startCss)},resumeTimeWith:function(e){console.log("%c<Animate> "+this.id+".resumeTimeWith("+e.id+")","color:blue"),this.set("timelineState",h.IS_RESUME_TIME),this.set("state","run"),this.set("target",e),this.runWithDelay(e.dom.element,-1*this.currentTime)},update:function(e,t){console.log("<Animate> "+this.id+".update("+e+", "+t+")");if(typeof t!="undefined"){var n=t-parseFloat(this.delay)*1e3,r=this.delayRemain+n;console.log("delayDelta = "+n+", delayRemain = "+r),r<0&&(console.log("oops"),r=0),this.set("delay",t/1e3+"s"),this.set("delayRemain",r),this.set("currentTime",this.currentTime-n),console.log("this.currentTime =>> "+this.currentTime)}typeof e!="undefined"&&(this.set("duration",e/1e3+"s"),this.set("totalDuration",e*this.iteration),this.set("iterated",Math.floor(this.currentTime/e))),console.log(this)},setTimeWith:function(e,t,n){console.log("\r\n● <Animate> "+this.id+".setTimeWith("+e.id+","+t+")"),console.log("this.duration = "+this.duration),console.log("node.dom.element.id = "+e.dom.element.id);if(parseFloat(this.duration)==0){console.log(this.id+" : this.duration == 0"),console.log(" ### return ###\r\n");return}var r=e.dom.element,s=Math.abs(this.currentTime-t);console.log(" >>>> this.totalDuration = "+this.totalDuration+", this.delay = "+this.delay+", this.currentTime = "+this.currentTime+", msec = "+t+", delta = "+s);var o=parseFloat(this.delay)*1e3+t;console.log("actualPos = "+o);if(o==0)this.unbindAnimation(),this.resetStates();else if(s<=.5&&!n){console.log(" ### delta <= 0.1 && !ignoreDelta return ###\r\n");return}this.set("currentTime",t),this.set("timelineState",h.IS_SET_TIME),t<this.totalDuration?this.set("state","pause"):this.set("state","stop"),r.style[a.fixProp("animationPlayState")]==="running"&&(this.unbindAnimation(),r.style.visibility="hidden");var f=u.byId("clone_"+r.id);f.style[a.fixProp("animationName")]!="none"&&f.style[a.fixProp("animationPlayState")]==="running"&&(console.log("clone.style[css.fixProp('animationName')] = "+f.style[a.fixProp("animationName")]),console.log("clone.style[css.fixProp('animationPlayState')] = running"),i.agent==="qt"?setTimeout(function(e){a.resetAnimation(e)},1,f):a.resetAnimation(f)),r.style[a.fixProp("animationName")]!==""&&r.style[a.fixProp("animationPlayState")]==="paused"&&(console.log(">>> paused !!!"),this.unbindAnimation());var l=parseFloat(this.get("duration"))*1e3,c;t>=0?(this.set("delayRemain",0),this.set("iterated",Math.floor(t/l))):(this.set("delayRemain",-1*t),this.set("iterated",0),t=0),console.log(" >> this.currentTime = "+this.currentTime),console.log(" >> this.delayRemain = "+this.delayRemain),console.log(" >> this.iterated = "+this.iterated),this.runWithDelay(f,-1*t),this.set("target",e)}},statics:{IS_SET_TIME:1,IS_RESUME_TIME:2,IS_DETECT_START:3,IS_GET_CSS:4,DETECT_START_CSS:"detectStartCss",SET_TIME:"setTime",eventLog:function(e,t,n){if(!e.target)return;console.log("");var r={0:"IS_NORMAL",1:"IS_SET_TIME",2:"IS_RESUME_TIME",3:"IS_DETECT_START"};s.event(t.animationName+" -> "+t.target.id+" > "+n+", timelineState="+r[e.timelineState])},dispatchSetTimeEvent:function(e,t,n,r){u.dispatchEvent(e,h.SET_TIME,{selector:t,currentTime:n,css:u.getComputedStyleClone(e),animate:r},!0,!0)},addAniEvent:function(){console.log("Animate::addAniEvent()"),u.addEvent(document,a.fixEvent("animationStart"),function(e){console.log("---------- animationStart >> "+e.animationName);var t=f.getObjectById(e.animationName,"Animate");if(typeof t=="undefined")return;var n=t.target;if(!n)return;var r=n.dom.element,i=u.byId("clone_"+r.id);h.eventLog(t,e,"Start"),n.visible===!0&&(r.style.visibility="visible");if(t.timelineState===h.IS_SET_TIME){i.style[a.fixProp("animationPlayState")]="paused";var s=h.getCloneStyle(i),o=u.checkComputedStyleDiff(t.originCss,s);t.currentTime>0&&o===!1?console.log("animate.originCss === movedStyle --> dom.setStyles() canceled"):t.currentTime<=0?t.setStyleByDiff(r,t.startCss):t.setStyleByDiff(r,s),a.resetAnimation(i),t.set("target",null)}else t.timelineState===h.IS_DETECT_START?(t.set("startCss",h.getCloneStyle(i)),console.log(t.target.id+" > "+JSON.stringify(t.startCss)),setTimeout(function(e){a.resetAnimation(e),e.set("target",null)},1,t),t.set("timelineState",0),u.dispatchEvent(r,h.DETECT_START_CSS,{animate:t,node:n},!0,!0)):t.timelineState===h.IS_RESUME_TIME?(t.set("timelineState",0),t.handlers.resumeTime(t)):t.handlers.start(t)}),u.addEvent(document,a.fixEvent("animationIteration"),function(e){var t=f.getObjectById(e.animationName,"Animate");if(typeof t=="undefined")return;h.eventLog(t,e,"Iteration"),t.handlers.iteration(t),t.set("iterated",t.get("iterated")+1)}),u.addEvent(document,a.fixEvent("animationEnd"),function(e){var t=f.getObjectById(e.animationName,"Animate");if(typeof t=="undefined")return;h.eventLog(t,e,"End"),t.timelineState!=h.IS_SET_TIME&&t.handlers.end(t),t.set("state","stop"),t.set("timelineState",0),console.log(t.id+".state = "+t.state),console.log(t.id,t)})},getCloneStyle:function(e){console.log("Animate::getCloneStyle("+e.id+")");var t,n,r={},s=window.getComputedStyle(e);for(t=0;t<s.length;t++)n=s[t],n.substr(0,c)!==a.fixInline("animation-")&&n!=="visibility"&&(r[n]=s[n]);return typeof r[a.fixInline("transform")]=="string"&&r[a.fixInline("transform")]==="matrix(1, 0, 0, 1, 0, 0)"&&(r[a.fixInline("transform")]="none"),i.agent==="qt"&&r["clip"]=="rect(0px 0px 0px 0px)"&&(r.clip="auto"),r.kerning=parseInt(r.kerning)+"px",r["stroke-dashoffset"]=parseInt(r["stroke-dashoffset"])+"px",r["stroke-width"]=parseInt(r["stroke-width"])+"px",r["z-index"]==="auto"&&(r["z-index"]="0"),r}}});u.addEvent(document,h.DETECT_START_CSS,function(e){s.event(h.DETECT_START_CSS);var t=e.bundle.node,n=e.bundle.animate;n.goToStartFrameWith(t)}),h.addAniEvent(),n.exports=h}),define("nodes/Scene",["require","exports","module","common/util","common/dom","bases/BaseObject","bases/Registry","bases/Timer","nodes/Node","actions/Animate"],function(e,t,n){var r=e("common/util"),i=e("common/dom"),s=e("bases/BaseObject"),o=e("bases/Registry"),u=e("bases/Timer"),a=e("nodes/Node"),f=e("actions/Animate"),l=r.Class({name:"Scene",extend:a,init:function(e){l.super.init.apply(this,arguments),this.transit=e.transit||""},dynamics:{transit:null,addLayer:function(e){this.addChild(e)},play:function(){console.log("<Scene> "+this.id+".play()")},stop:function(){console.log("<Scene> "+this.id+".stop()")},clone:function(){console.log("<Scene> "+this.id+".clone()");var e="0px",t="0px",n=this.dom.element,r=i.shadowNode(n,!0),s=i.getStyle(n,"zIndex"),o=i.getStyle(n,"position");isNaN(parseInt(s))?s=-1:s-=1,o=="absolute"&&(e=i.getAbsPos(n,"Top")+"px",t=i.getAbsPos(n,"Left")+"px"),i.setStyles(r,{backgroundColor:"red",position:"absolute",zIndex:s,top:e,left:t}),i.addElement(r,n,"after")}},statics:{CLONE_READY:"cloneReady"}});n.exports=l}),define("nodes/shapes/Shape",["require","exports","module","common/util","nodes/Node"],function(e,t,n){var r=e("common/util"),i=e("nodes/Node"),s=r.Class({name:"Shape",extend:i,init:function(e){s.super.init.apply(this,arguments)},dynamics:{},statics:{}});n.exports=s}),define("nodes/shapes/ImageShape",["require","exports","module","common/util","nodes/shapes/Shape"],function(e,t,n){var r=e("common/util"),i=e("nodes/shapes/Shape"),s=r.Class({name:"ImageShape",extend:i,init:function(e){s.super.init.apply(this,arguments)},dynamics:{},statics:{}});n.exports=s}),define("nodes/shapes/ContainerShape",["require","exports","module","common/util","nodes/shapes/Shape"],function(e,t,n){var r=e("common/util"),i=e("nodes/shapes/Shape"),s=r.Class({name:"ContainerShape",extend:i,init:function(e,t){s.super.init.apply(this,arguments);if(e.children&&e.children.length){var n,r,i=e.children,t=s.Factory;for(n in i)r=t.create(i[n]),this.addChild(r)}},dynamics:{},statics:{Factory:null,create:function(e,t){return this.Factory=t,new this(e)}}});n.exports=s}),define("nodes/ShapeFactory",["require","exports","module","common/util","bases/BaseObject","nodes/shapes/Shape","nodes/shapes/ImageShape","nodes/shapes/ContainerShape"],function(e,t,n){var r=e("common/util"),i=e("bases/BaseObject"),s=e("nodes/shapes/Shape"),o=e("nodes/shapes/ImageShape"),u=e("nodes/shapes/ContainerShape"),a=r.Class({name:"ShapeFactory",extend:i,init:function(e){a.super.init.apply(this,arguments)},dynamics:{},statics:{create:function(e){return e.hasOwnProperty("children")&&e.children.length>0&&(e.type="Container"),e.type&&this.factories[e.type]?this.factories[e.type].create(e,this):s.create(e)},factories:{Image:o,Container:u}}});n.exports=a}),define("nodes/Layer",["require","exports","module","common/util","nodes/Node","nodes/ShapeFactory"],function(e,t,n){var r=e("common/util"),i=e("nodes/Node"),s=e("nodes/ShapeFactory"),o=r.Class({name:"Layer",extend:i,init:function(e){o.super.init.apply(this,arguments)},dynamics:{addShape:function(e){this.addChild(e)}},statics:{}});n.exports=o}),define("extras/AniGroup",["require","exports","module","common/util","common/logger","common/string","common/dom","common/css","dom/Dom","nodes/Scene","nodes/Layer","actions/Animate","bases/BaseObject","bases/Registry"],function(e,t,n){var r=e("common/util"),i=e("common/logger"),s=e("common/string"),o=e("common/dom"),u=e("common/css"),a=e("dom/Dom"),f=e("nodes/Scene"),l=e("nodes/Layer"),c=e("actions/Animate"),h=e("bases/BaseObject"),p=e("bases/Registry"),d=function(e){o.byId("tizenplaystyle")||o.makeElement("style",{id:"tizenplaystyle"});var t=document.styleSheets,n=t[t.length-1],r=n.cssRules?n.cssRules.length:0;u.insertRule(n,"@"+u.inlinePrefix+"keyframes "+e,"from{opacity:0} to{opacity:0.5}",r)},v=function(e,t){return o.makeElement("div",{id:t,style:"visibility:hidden,width:0;height:0;"},{element:e.dom.element,position:"inside"})},m=r.Class({name:"AniGroup",extend:l,init:function(e){m.super.init.apply(this,arguments),d(this.id),console.log("AniGroup.isIDE = "+m.isIDE),m.isIDE&&(e.iteration=1),this.set("action",c.create({id:this.id,delay:"0s",direction:"normal",timing:"linear",duration:e.duration,iteration:e.iteration,justplay:e.justplay,holdEnd:e.holdEnd,handlers:{start:function(e){e.target.playPairs(),o.dispatchEvent(e.target.dom.element,m.ANI_GROUP_START,{aniGroup:e.target,aniGroupId:e.target.id,animateId:e.id},!0,!0)},iteration:function(e){e.target.stopPairs(),e.target.playPairs(),o.dispatchEvent(e.target.dom.element,m.ANI_GROUP_ITERATION,{aniGroup:e.target,aniGroupId:e.target.id,animateId:e.id},!0,!0)},end:function(e){console.log("<Animate> "+e.id+".handlers.end("+e.id+")"),o.dispatchEvent(e.target.dom.element,m.ANI_GROUP_END,{aniGroup:e.target,aniGroupId:e.target.id,animateId:e.id},!0,!0),setTimeout(function(e){e.target&&e.target.stop()},50,e)},resumeTime:function(e){console.log("<Animate> "+e.id+".handlers.resumeTime("+e.id+")"),e.target.resumeTimePairs()}}}));if("members"in e&&e.members.length){var t,n,r,i;for(t in e.members)i=e.members[t],n=i.id,r=c.create(i.animation),this.makePair(n,r),this.addChild(p.getObjectById(n,"Shape"))}},dynamics:{action:null,pairs:null,makePair:function(e,t){this.pairs||(this.pairs={}),this.setAssoc("pairs",e,t)},addToScene:function(e){e.addChild(this),v(e,this.id),this.set("dom",a.create({id:this.id}))},repeater:null,currentTime:0,currentTimePaused:0,runRepeater:function(){console.log("<AniGroup> "+this.id+".runRepeater()"),console.log(" this.currentTimePaused = "+this.currentTimePaused),console.log(" this.repeater = "+this.repeater);if(this.repeater===null){var e=(new Date).getTime();this.repeater=setInterval(function(t){var n,r,i,s=(new Date).getTime()-e+t.currentTimePaused;t.action.totalDuration>s?t.currentTime=s:t.currentTime=t.action.totalDuration,o.dispatchEvent(t.dom.element,m.ANI_GROUP_TIME_UPDATE,{id:t.dom.element.id,currentTime:t.currentTime},!0,!0);for(n in t.pairs)r=p.getObjectById(n,"Node"),i=t.pairs[n],r&&i&&i.set("currentTime",t.currentTime-parseFloat(i.delay)*1e3)},1,this)}else console.log("repeater exists. this.repeater = "+this.repeater)},pauseRepeater:function(e){clearInterval(this.repeater),this.currentTimePaused=e,this.repeater=null},stopRepeater:function(){clearInterval(this.repeater),this.repeater=null,this.currentTime=0,this.currentTimePaused=0},play:function(){var e={0:"IS_NORMAL",1:"IS_SET_TIME",2:"IS_RESUME_TIME",3:"IS_DETECT_START"};console.log("\r\n<AniGroup> "+this.id+".play(), this.action.state="+this.action.state+", timelineState="+e[this.action.timelineState]);if(this.action.timelineState===c.IS_SET_TIME){console.log("this.action.currentTime = "+this.action.currentTime),console.log("this.action.totalDuration = "+this.action.totalDuration);if(!(this.action.currentTime<this.action.totalDuration)){console.log("play() case 3"),this.stop(),setTimeout(function(e){e.play()},10,this);return}if(this.action.state!="pause"){console.log("play() case 2"),console.warn("other case : see here");return}console.log("play() case 1"),this.resumeTime()}else if(this.action.state=="stop")console.log("play() case 4"),this.stopRepeater(),this.runAction(this.action);else{if(this.action.state!="pause"){console.log("play() case 6"),console.warn("other case : see here");return}console.log("play() case 5"),this.resume()}this.runRepeater()},resumeTime:function(){console.log("\r\n<AniGroup> "+this.id+".resumeTime()"),this.action.resumeTimeWith(this)},resumeTimePairs:function(){console.log("\r\n<AniGroup> "+this.id+".resumeTimePairs()");var e,t,n,r,i,s;for(e in this.pairs)t=p.getObjectById(e,"Node"),n=this.pairs[e],t&&n&&n.resumeTimeWith(t)},pause:function(){console.log("<AniGroup> "+this.id+".pause()"),this.pausePairs(),this.pauseAction(this.action),this.pauseRepeater(this.currentTime)},resume:function(){console.log("<AniGroup> "+this.id+".resume()"),this.resumeAction(this.action),this.resumePairs()},stop:function(){console.log("<AniGroup> "+this.id+".stop()"),this.stopPairs(),this.stopAction(this.action),o.dispatchEvent(this.dom.element,m.ANI_GROUP_STOP,{aniGroup:this,aniGroupId:this.id,animateId:this.action.id},!0,!0),this.stopRepeater()},playPairs:function(){console.log("<AniGroup> "+this.id+".playPairs()");var e,t,n;for(e in this.pairs)t=p.getObjectById(e,"Node"),n=this.pairs[e],t&&n&&t.runAction(n)},pausePairs:function(){console.log("<AniGroup> "+this.id+".pausePairs()");var e,t,n;for(e in this.pairs)t=p.getObjectById(e,"Node"),n=this.pairs[e],t&&n&&t.pauseAction(n)},resumePairs:function(){console.log("<AniGroup> "+this.id+".resumePairs()");var e,t,n;for(e in this.pairs)t=p.getObjectById(e,"Node"),n=this.pairs[e],t&&n&&t.resumeAction(n)},stopPairs:function(){console.log("<AniGroup> "+this.id+".stopPairs()");var e,t,n;for(e in this.pairs)t=p.getObjectById(e,"Node"),n=this.pairs[e],t&&n&&t.stopAction(n)},goToStartFrame:function(){console.log("\r\n<AniGroup> "+this.id+".goToStartFrame()"),this.stopRepeater(),this.action.goToStartFrameWith(this);var e,t,n;for(e in this.pairs)t=p.getObjectById(e,"Node"),n=this.pairs[e],t&&n&&n.goToStartFrameWith(t)},resetAniGroup:function(){console.log("\r\n<AniGroup> "+this.id+".resetAniGroup()"),this.stopRepeater(),this.action.goToStartFrameWith(this);var e,t,n;for(e in this.pairs)t=p.getObjectById(e,"Node"),n=this.pairs[e],t&&n&&n.goToStartFrameWith(t)},setCurrentTime:function(e){console.log("%c\r\n<AniGroup> "+this.id+".setCurrentTime("+e+")","font-weight:bold; color:blue");var t,n,r,i,s,o,u;e>=this.action.totalDuration?(o=this.action.totalDuration,console.log("***** AniGroup > action over action.totalDuration ! *****")):o=e,this.action.setTimeWith(this,o),u=this.action.totalDuration*this.action.iterated,parseFloat(e)===0?this.stopRepeater():parseFloat(e)===this.action.totalDuration?this.stopRepeater():this.pauseRepeater(e);for(t in this.pairs)n=p.getObjectById(t,"Node"),r=this.pairs[t],n&&r&&(e>=this.action.totalDuration?(o=this.action.totalDuration-parseFloat(r.delay)*1e3,console.log("***** Node > animate over action.totalDuration ! *****")):(i=parseFloat(r.delay)*1e3,s=parseFloat(r.duration)*1e3,o=e-i-u),r.setTimeWith(n,o))},getCss:function(){console.log("\r\n<AniGroup> "+this.id+".getCss()");var e,t,n,r;for(e in this.pairs)t=p.getObjectById(e,"Node"),n=this.pairs[e],t&&n&&(r=t.dom.element,c.dispatchSetTimeEvent(r,"#"+r.id,n.currentTime))},detectCss:function(){console.log("%c<AniGroup> "+this.id+".detectCss()","color:yellowgreen");var e,t,n;this.action.detectStyleWith(this);for(e in this.pairs)t=p.getObjectById(e,"Node"),n=this.pairs[e],t&&n&&n.detectStyleWith(t)}},statics:{isIDE:!1,ANI_GROUP_START:"aniGroupStart",ANI_GROUP_ITERATION:"aniGroupIteration",ANI_GROUP_END:"aniGroupEnd",ANI_GROUP_STOP:"aniGroupStop",ANI_GROUP_TIME_UPDATE:"aniGroupTimeUpdate"}});n.exports=m}),define("nodes/Movie",["require","exports","module","common/util","common/dom","nodes/Node","extras/AniGroup"],function(e,t,n){var r=e("common/util"),i=e("common/dom"),s=e("nodes/Node"),o=e("extras/AniGroup"),u=r.Class({name:"Movie",extend:s,init:function(e){u.super.init.apply(this,arguments),i.addEvent(window,"loadScene",function(e){e.bundle.scene.play()})},dynamics:{oldScene:null,currentScene:null,addScene:function(e){console.log("<Movie> "+this.id+".addScene("+e.id+")"),this.addChild(e)},loadSceneById:function(e){console.log("<Movie> "+this.id+".loadSceneById("+e+")");if(e){var t=this.getChildById(e);this.loadScene(t)}},loadScene:function(e){console.log("<Movie> "+this.id+".loadScene("+e.id+")"),this.set("oldScene",this.get("currentScene")),this.set("currentScene",e),i.byId("clone_"+e.dom.element.id)?(this.detectCss(e),setTimeout(function(e){i.dispatchEvent(window,"loadScene",{scene:e})},50,e)):(e.clone(),setTimeout(function(e,t){e.detectCss(t),setTimeout(function(e){i.dispatchEvent(window,"loadScene",{scene:e})},50,t)},50,this,e))},detectCss:function(e){console.log("<Movie> "+this.id+".detectCss("+e.id+")");var t,n=e.children;for(t in n)n[t]instanceof o&&n[t].detectCss()}},statics:{}});n.exports=u}),define("facade/MovieManager",["require","exports","module","common/util","bases/BaseObject","bases/Registry","nodes/Node","nodes/Movie","nodes/Scene","nodes/Layer","nodes/ShapeFactory","extras/AniGroup"],function(e,t,n){var r=e("common/util"),i=e("bases/BaseObject"),s=e("bases/Registry"),o=e("nodes/Node"),u=e("nodes/Movie"),a=e("nodes/Scene"),f=e("nodes/Layer"),l=e("nodes/ShapeFactory"),c=e("extras/AniGroup"),h=r.Class({name:"MovieManager",extend:i,init:function(e){h.super.init.apply(this,arguments)},dynamics:{movie:null,loadScenario:function(e){console.log(e);var t,n,r,s,o,h,p,d,v,m,g,y,b;v=u.create({id:"movie"});if("scenes"in e){o=e.scenes;for(t in o){m=a.create(o[t]),v.addScene(m),o[t].show&&(console.log("movie.set('currentScene',"+m.id+")"),v.set("currentScene",m));if("layers"in o[t]){h=o[t].layers;for(n in h){g=f.create(h[n]),m.addLayer(g);if("shapes"in h[n]){p=h[n].shapes;for(r in p)y=l.create(p[r]),g.addShape(y)}}}if("aniGroups"in o[t]){d=o[t].aniGroups;for(s in d)i.isEmpty(d[s])||(b=c.create(d[s]),b.addToScene(m))}}}return console.log("\r\n",v,"\r\n"),this.movie=v,v},addWidget:function(e,t,n,r,i){console.log("<MovieManager> movieManager.addWidget(id, containerId, animateId, angroupId, type)");var o=s.getObjectById(t),u=l.create({id:e,type:i});o.addChild(u);var a=s.getObjectById(r,"AniGroup");console.log(a)}},statics:{singleton:null,create:function(){return this.singleton==null&&(this.singleton=new this),this.singleton}}});n.exports=h}),define("common/bootstrap",["require","exports","module","common/env"],function(e,t,n){var r=e("common/env");n.exports={init:function(e){console.log("bootstrap.init()"),r.init(e)}}}),define("proxy/wub/TizenPlay",["require","exports","module","facade/MovieManager","common/bootstrap","common/logger","common/string","common/dom","nodes/Scene","bases/Registry","actions/Animate","extras/AniGroup"],function(e,t,n){var r=e("facade/MovieManager"),i=e("common/bootstrap"),s=e("common/logger"),o=e("common/string"),u=e("common/dom"),a=e("nodes/Scene"),f=e("bases/Registry"),l=e("actions/Animate"),c=e("extras/AniGroup"),h="font-size:14pt; font-weight:bold",p={movieManager:null,movie:null,logger:s,dom:u,string:o,log:function(){console.log.apply(console,arguments)},init:function(){console.log("%cTizenPlay.init()",h),i.init({useJQuery:!0}),typeof tizenPlayIsIDE!="undefined"&&tizenPlayIsIDE===!0&&(c.isIDE=!0),u.addEvent(window,"loadScene",function(e){s.event("loadScene : "+e.bundle.scene.id),console.log("AniGroup.isIDE = "+c.isIDE),c.isIDE===!1&&p.playPage(e.bundle.scene)})},bindTizenEvents:function(e){console.log("%c\r\nTizenPlay.bindTizenEvents(config)",h);var t,n,r,i,o,u,a;if(typeof jQuery=="undefined"){console.log("jQuery not found");return}typeof jQuery("body").live=="function"?a="live":a="on";var l=function(e){var t,n,r,i;if(e.children)for(i in e.children)l(e.children[i]);if(e.events){t=e.events;for(n in t)for(i in t[n])r=t[n][i],console.log("jQuery(#"+e.id+")."+a+"("+n+", function(oEvent){"+r.target+"."+r.act+"("+r.time+")})"),jQuery("#"+e.id)[a](n,function(e){s.event(e.target+" "+e.type),console.log(r.type,r.target,r.act),setTimeout(function(e){if(e.type==="AniGroup"){var t=f.getObjectById(e.target,"AniGroup");t[e.act](e.time)}},100,r)})}};if("scenes"in e){i=e.scenes;for(t in i){jQuery("#"+i[t].id).on("pageshow",function(e){var t=jQuery(this).attr("id");setTimeout(function(e){s.event("pageshow : "+e),p.movie.loadSceneById(e)},100,t)}),l(i[t]);if("layers"in i[t]){o=i[t].layers;for(n in o)if("shapes"in o[n]){u=o[n].shapes;for(r in u)l(u[r])}}}}},addWidget:function(e,t,n,r,i){this.movieManager.addWidget(e,t,r,i)},updateAnimation:function(e,t,n,r,i){console.log("%cTizenPlay.updateAnimation("+e+", "+t+", "+n+", "+r+", "+i+")",h);var s=f.getObjectById(e,"AniGroup"),o=s.getChildById(t);console.log(o);var u=f.getObjectById(n,"Animate");u.update(r,i),u.setTimeWith(o,u.currentTime,!0);var a,l,c,d=0;for(a in s.pairs)l=s.pairs[a],c=parseFloat(l.delay)*1e3+parseFloat(l.duration)*1e3,c>d&&(d=c);d!=parseFloat(s.action.duration)*1e3&&(s.action.update(d,0),s.action.setTimeWith(s,s.action.currentTime,!0),p.dom.dispatchEvent(document,p.ANI_GROUP_DURATION_UPDATE,{id:s.id,duration:s.action.duration},!0,!0))},applyAnimation:function(e,t){console.log("%cTizenPlay.applyAnimation("+e+", "+t+")",h);var n=f.getObjectById(e,"Node"),r=f.getObjectById(t,"Animate");r.detectStyleWith(n)},loadPlayModel:function(e){console.log("%c\r\nTizenPlay.loadPlayModel(config)",h);var t=e,n=function(e){var t=e[e.length-1];return t.children?n(t.children):t};if(!t.scenes[0].layers[0].shapes)throw new Error("shapes not defined");var i=t.scenes[0].layers[0].shapes,s=n(i);return console.log("lastChild = "+s.id),document.getElementById(s.id)?(this.movieManager=r.create(),this.movie=this.movieManager.loadScenario(t),setTimeout(function(e){console.log("AniGroup.isIDE = "+c.isIDE);if(c.isIDE===!0){console.log("typeof that.movie.currentScene.id = "+typeof e.movie.currentScene.id);try{e.movie.loadScene(e.movie.currentScene)}catch(t){console.log(t.message)}}p.dom.dispatchEvent(window,p.LOAD_PLAY_MODEL,{movie:this.movie},!0,!0)},300,this),console.log("Registry.getRegistry()",f.getRegistry()),!0):(console.warn(s.id+" element not found"),!1)},Registry:f,getAniGroups:function(e){var t,n=[];for(t in e.children)e.children[t]instanceof c&&n.push(e.children[t]);return n},getGroupsByState:function(e,t){var n,r=[],i=this.getAniGroups(e);for(n in i)console.log(i[n].id,i[n].action.state),i[n].action.state===t&&r.push(i[n]);return r},getGroupsById:function(e){var t,n=[],r;typeof e=="string"&&(e=[e]);for(t in e)r=f.getObjectById(e[t],"AniGroup"),r&&n.push(r);return n},getJustPlayGroups:function(e){var t,n=[],r=this.getAniGroups(e);for(t in r)r[t].action.justplay===!0&&n.push(r[t]);return n},getCurrentPage:function(){return console.log("TizenPlay.getCurrentPage()"),this.movie.get("currentScene")},playCurrentPage:function(){console.log("%c\r\nTizenPlay.playCurrentPage()",h),this.playPage(this.movie.get("currentScene"))},playPage:function(e){console.log("%c\r\nTizenPlay.playPage(<Scene> "+e.id+")",h),this.playAniGroups(e,this.getJustPlayGroups(e))},playPageById:function(e){console.log("TizenPlay.playPageById("+e+")"),this.playPage(f.getObjectById(e,"Scene"))},playAllAniGroups:function(e){console.log("%c\r\nTizenPlay.playAllAniGroups(<Scene> "+e.id+")",h),this.playAniGroups(e,this.getAniGroups(e))},playAniGroups:function(e,t){console.log("%cTizenPlay.playAniGroups(<Scene> "+e.id+", [aniGroups])",h),console.log("aniGroups",t);var n,r={stop:0,pause:0,run:0};for(n in t)r[t[n].action.state]++;if(r.run===0)if(r.pause===0||r.stop===0)for(n in t)t[n].play();else for(n in t)t[n].action.state==="pause"&&(console.log(t[n].id+".action.state = "+t[n].action.state),t[n].play())},playAniGroupsById:function(e,t){console.log("TizenPlay.playAniGroupsById("+e+", "+t+")");var n=f.getObjectById(e,"Scene"),r=this.getGroupsById(t);this.playAniGroups(n,r)},pauseCurrentPage:function(){console.log("\r\nTizenPlay.pauseCurrentPage()"),this.pausePage(this.movie.get("currentScene"))},pausePage:function(e){console.log("TizenPlay.pausePage(<Scene> "+e.id+")"),this.pauseAniGroups(e,this.getGroupsByState(e,"run"))},pausePageById:function(e){console.log("TizenPlay.pausePageById("+e+")"),this.pausePage(f.getObjectById(e,"Scene"))},pauseAniGroups:function(e,t){var n=[];for(var r in t)n.push(t[r].id);console.log("TizenPlay.pauseAniGroups(<Scene> "+e.id+", "+JSON.stringify(n)+")");var r;for(r in t)t[r].pause()},pauseAniGroupsById:function(e,t){console.log("TizenPlay.pauseAniGroups("+e+", "+t+")");var n=f.getObjectById(e,"Scene"),r=this.getGroupsById(t);this.pauseAniGroups(n,r)},stopCurrentPage:function(){console.log("\r\nTizenPlay.stopCurrentPage()"),this.stopPage(this.movie.get("currentScene"))},stopPage:function(e){console.log("TizenPlay.stopPage(<Scene> "+e.id+")"),this.stopAniGroups(e,this.getAniGroups(e))},stopPageById:function(e){console.log("TizenPlay.stopPage("+e+")"),this.stopPage(f.getObjectById(e,"Scene"))},stopAniGroups:function(e,t){console.log("TizenPlay.stopAniGroups(<Scene> "+e.id+", [aniGroups])");var n;for(n in t)t[n].stop()},stopAniGroupsById:function(e,t){console.log("TizenPlay.stopAniGroups("+e+", "+t+")");var n=f.getObjectById(e,"Scene"),r=this.getGroupsById(t);this.stopAniGroups(n,r)},goToStartFrame:function(e){console.log("\r\nTizenPlay.goToStartFrame("+JSON.stringify(e)+")");var t,n;e?(typeof e=="string"&&(e=[e]),t=this.getGroupsById(e)):t=this.getAniGroups(this.movie.get("currentScene"));for(n in t)t[n].goToStartFrame()},setCurrentTime:function(e,t){console.log("%c\r\nTizenPlay.setCurrentTime("+e+", "+JSON.stringify(t)+")",h);var n,r;t?(typeof t=="string"&&(t=[t]),n=this.getGroupsById(t)):n=this.getAniGroups(this.movie.get("currentScene"));for(r in n)n[r].setCurrentTime(e)},getCssByGroupId:function(e){console.log("%c\r\nTizenPlay.getCssByGroupId("+e+")",h);var t,n;e?(typeof e=="string"&&(e=[e]),t=this.getGroupsById(e)):t=this.getAniGroups(this.movie.get("currentScene"));for(n in t)t[n].getCss()},setVisible:function(e,t){console.log("%c\r\nTizenPlay.setVisible("+e+", "+t+")",h);var n=f.getObjectById(e,"Node");n.set("visible",t),console.log(n)},ANI_GROUP_START:c.ANI_GROUP_START,ANI_GROUP_ITERATION:c.ANI_GROUP_ITERATION,ANI_GROUP_END:c.ANI_GROUP_END,ANI_GROUP_STOP:c.ANI_GROUP_STOP,ALL_ANI_GROUP_STOP:"allAniGroupStop",SET_TIME:"setTime",ANI_GROUP_TIME_UPDATE:c.ANI_GROUP_TIME_UPDATE,ANI_GROUP_DURATION_UPDATE:"aniGroupDurationUpdate",TIZEN_PLAY_READY:"tizenPlayReady",LOAD_PLAY_MODEL:"loadPlayModel",convertToScenario:function(e){var t={},n,r,i,s,o,u=function(e){switch(e.type){case"animation":return e.animationWidget==="All"?{id:e.id,type:"AniGroup",target:e.targetId,act:e.method}:{id:e.id,type:"Animation",target:e.animationWidget,act:e.method};case"others":return{};default:}},a=function(e){if(!e)return null;var t,n,r={},i,s;for(t in e){i=new Array,s=e[t].actions;for(n in s)i.push(u(s[n]));r[e[t].eventName]=i}return r},f=function(e){if(!e)return null;var t,n=[];for(t in e)e[t].childWidgets&&e[t].childWidgets.length&&(e[t].type="Container"),n.push({id:e[t].id,type:e[t].type,children:f(e[t].childWidgets),animation:null,events:a(e[t].triggers)});return n},l=function(e){var t,n,r=[],i,s,o;for(t in e)if("keyframes"in e[t]&&e[t].keyframes.length){i=new Array,s=e[t].keyframes;for(n in s)o=s[n],i.push({id:o.targetId,animation:{id:o.id,delay:o.delay,duration:o.duration,iteration:o.iteration,direction:"normal",timing:o.easing,holdEnd:o.holdEnd,justplay:o.active}});r.push({id:e[t].id,members:i,duration:e[t].duration,iteration:e[t].iteration,holdEnd:e[t].holdEnd,justplay:e[t].autoPlay})}return r};if("pages"in e){n=e.pages,t.scenes=new Array;for(i in n)r={id:n[i].id,show:n[i].active,transit:n[i].transition,layers:[{id:"layer"+(1+parseInt(i)),shapes:f(n[i].widgets),animation:null,events:null}],animation:null,events:a(n[i].triggers),aniGroups:l(n[i].animations)},t.scenes.push(r)}return t}};p.dom.addEvent(document,p.ANI_GROUP_START,function(e){}),p.dom.addEvent(document,p.ANI_GROUP_STOP,function(e){s.event(p.ANI_GROUP_STOP);var t=e.bundle.aniGroup.parent,n=p.getAniGroups(t),r=p.getGroupsByState(t,"stop");setTimeout(function(e){n.length==r.length&&p.dom.dispatchEvent(e.dom.element,p.ALL_ANI_GROUP_STOP,{},!0,!0)},1,t)}),n.exports=p}),requirejs.config({baseUrl:"tizenplay/libs",paths:{app:"../app",proxy:"../proxy"},urlArgs:"bust="+(new Date).getTime()});var TizenPlay;(function(){require(["proxy/wub/TizenPlay"],function(e){typeof ComingBridge!="undefined"&&typeof ComingBridge.printLog=="function"&&typeof console=="object"&&(console.log=ComingBridge.printLog,console.warn=ComingBridge.printLog),TizenPlay=e,TizenPlay.dom.dispatchEvent(window,TizenPlay.TIZEN_PLAY_READY,TizenPlay,!0,!0),TizenPlay.init(),TizenPlay.bindTizenEvents(tizen_animator_cfg);if(typeof tizenPlayIsIDE=="undefined"||tizenPlayIsIDE===!1){var t=null,n=0;(function(){t=setInterval(function(){TizenPlay.loadPlayModel(tizen_animator_cfg)&&(clearInterval(t),t=null),t&&n>20&&(clearInterval(t),t=null,console.warn("TizenPlay.loadPlayModel(tizen_animator_cfg) failed")),n++},100),setTimeout(function(){clearInterval(t),t=null},3e3)})()}})})(),define("app/main.wub",function(){});
\ No newline at end of file
+})();
+define("app/main.wub", function(){});