/**
 * @license SmartBuilder4 HTML5 widget framework, Copyright (c) 2014
 *          SuddenlySmart;
 * @author Kent Xu
 */

/*!
 * jQuery UI Effects 1.11.2
 * http://jqueryui.com
 *
 * Copyright 2014 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * http://api.jqueryui.com/category/effects-core/
 */

/*!
 * jQuery Color Animations v2.1.2
 * https://github.com/jquery/jquery-color
 *
 * Copyright 2014 jQuery Foundation and other contributors
 * Released under the MIT license.
 * http://jquery.org/license
 *
 * Date: Wed Jan 16 08:47:09 2013 -0600
 */

/**
 * @license SmartBuilder4 HTML5 widget framework, Copyright (c) 2014 SuddenlySmart;
 * @author Kent Xu
 */

/**
 * @license SmartBuilder4 HTML5 widget framework, Copyright (c) 2014 SuddenlySmart;
 * @author Kent Xu
 * SlideSet
 */

/**
 * @license SmartBuilder4 HTML5 widget framework, Copyright (c) 2014 SuddenlySmart;
 * @author Kent Xu
 * Slide
 */

/**
 * jquery.timer.js
 *
 * Copyright (c) 2011 Jason Chavannes <jason.chavannes@gmail.com>
 *
 * http://jchavannes.com/jquery-timer
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use, copy,
 * modify, merge, publish, distribute, sublicense, and/or sell copies
 * of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

define("sb4core/sbobjfactory",["./DataUtil","jquery","underscore","jqueryui/widget","util/jquery-color"],function(t,e,i){function s(t){this.engine=t}return s.prototype.create=function(t,e,i,s){this.div=t,this.data=e;var r=this._createObj(t,e,i,s);return r},s.prototype._createObj=function(t,e,i,s){var r=e.eClass;null==r&&(r=s);var n=null;return null==i||"Frame"==r?(r="Frame",n=this._createFrame(t,e,i)):"SlideSet"==r?n=this._createSlideSet(t,e,i):"Slide"==r?n=this._createSlide(t,e,i):"Widget"==r&&(n=this._createWidget(t,e,i)),null!=n&&this.engine.objctx.add(e.id,n.data("sb4-"+n.data("sb4type"))),n},s.prototype._createFrame=function(t,e,i){var s,r={_p:null==i?null:i.data("sb4-"+i.data("sb4type"))};this._parseBaseOptions(e,r),this._parseBounds(e.bounds,r);var n="com.smartbuilder.axon.widget.frame";return this._parseDataEntries(e.data,r),s=this._createSBObj(t,n,r)},s.prototype._createSlide=function(t,e,i){var s=void 0,r={_p:null==i?null:i.data("sb4-"+i.data("sb4type"))};this._parseBaseOptions(e,r);var n="com.smartbuilder.axon.widget.slide";e.type=n,s=this._createSBObj(t,n,r);var o=e.widgets;for(var a in o){var h=this._createObjDiv(t),l=this._createObj(h,o[a],s,"Widget");this._activateObjDiv(h,void 0!=l)}return s},s.prototype._createSlideSet=function(e,i,s){var r=void 0,n={_p:null==s?null:s.data("sb4-"+s.data("sb4type"))};this._parseBaseOptions(i,n),void 0!=i.mode?n.mode=i.mode:(n.mode=t.getInt(i.type,0),i.mode=n.mode);var o="com.smartbuilder.axon.widget.slideset";i.type=o,r=this._createSBObj(e,o,n);var a=i.slides;for(var h in a){var l=this._createObjDiv(e),c=this._createObj(l,a[h],r,"Slide");this._activateObjDiv(l,void 0!=c)}return r},s.prototype._createWidget=function(t,e,i){var s=void 0,r={_p:null==i?null:i.data("sb4-"+i.data("sb4type"))};this._parseBaseOptions(e,r),this._parseBounds(e.bounds,r);var n=e.type;return this._parseDataEntries(e.data,r),s=this._createSBObj(t,n,r)},s.prototype._createSBObj=function(t,i,s){var r;void 0==s&&(s={}),s._engine=this.engine;var n=sb4runtime.getWidgetInfo(i);if(void 0!=n){var o=n.widgetsvc.getShortUIKey();if(""!=s._tags){var a=s._tags.split(" ");for(var h in a)e(t).addClass("tag-"+a[h])}delete s._tags;try{e(t).data("sb4type",o),r=e(t)[o](s)}catch(l){r=null}}return r},s.prototype._createObjDiv=function(t){var i=e("<div class='temp'>",{}).appendTo(t);return i},s.prototype._createObjDivBefore=function(t){var i=e("<div class='temp'>",{}).insertBefore(t);return i},s.prototype._activateObjDiv=function(t,i){i?t.removeClass("temp"):e(t).remove()},s.prototype._parseBounds=function(e,i){null==e&&(e={}),i._x=t.getInt(e.x,0),i._y=t.getInt(e.y,0),i._w=t.getInt(e.w,0),i._h=t.getInt(e.h,0)},s.prototype._parseBaseOptions=function(e,i){i._i=t.getDefaultString(e.id,""),i._n=t.getDefaultString(e.name,""),i._z=t.getInt(e.z,0),i._fxi=t.getInt(e.fxi,""),i._fxo=t.getInt(e.fxo,""),i._tags=t.getDefaultString(e.tags,""),t.isFalse(e.v)&&(i._v=!1),i._d=e},s.prototype._parseDataEntries=function(t,e){var s=t;if(s&&s.entries){var r=s.entries;for(var n in r){var o=r[n].id;if("_prf"==o){var a={},h=r[n].subs;for(var l in h){var c=h[l],u=c.id,d={},p=[],f=c.subs;for(var g in f){var v=f[g],m=v.id,b=this._parseIData(v),_={};_[m]=b.subs?b:b[m],p.push(_)}d.subs=p,a[u]=i.extend(d,JSON.parse(c.value))}e[o]=a}else{var x=this._parseIData(s.entries[n]);e[o]=x.subs?x:x[o]}}}},s.prototype._parseIData=function(s){var r={},n=s.id,o=void 0,a=s.eClass;if("StrData"==a)o=t.getDefaultString(s.value,"");else if("BoolData"==a)o=t.isTrue(s.value);else if("ColorData"==a)if(null!=s.cid)o="#"+s.cid;else{var h=e.Color(t.getInt(s.R,0),t.getInt(s.G,0),t.getInt(s.B,0),1);o=h.toHexString()}else if("NumData"==a)o=t.parseNumber(s.value);else if("FontData"==a){var l={};void 0!=s["class"]&&(l["class"]=s["class"]),void 0!=s.name&&(l.fontStyle=0==t.getInt(s.style,0)?"normal":"italic",l.fontWeight=0==t.getInt(s.weight,0)?"normal":"bold",l.fontSize=t.getInt(s.size,10),l.fontFamily=s.name),o=l}else"SizeData"==a?o=[t.getInt(s.W,0),t.getInt(s.H,0)]:"ResData"==a?o=t.getDefaultString(s.key,""):"GSONData"==a&&(o=i.string.isBlank(s.value)?{}:JSON.parse(s.value));r[n]=o;var c=s.subs;if(void 0!=c){var u=[];for(var d in c)u.push(this._parseIData(c[d]));r.subs=u}return r},s}),define("sb4core/ObjContext",["underscore","sb4core/DataUtil"],function(t,e){function i(e,i){this.extctx=e,this.map={},t.isFunction(i)&&(this.optionalFinder=i)}return i.objMap={},i.prototype.getObjMap=function(){return i.objMap},i.prototype.getTopMap=function(s){s=e.parseString(s);var r;return t.str.isBlank(s)||(t.has(i.objMap,s)||(this.getObjMap()[s]={}),r=this.getObjMap()[s]),r},i.prototype.fork=function(t){return new i(this,t)},i.prototype.pop=function(t){return arguments.length>0&&1==t||(this.map=void 0),this.extctx},i.prototype.add=function(t,e){this.map[t]=e},i.prototype.set=function(e,i){var s=!1;return t.has(this.map,e)?(this.map[e]=i,!0):s?!0:void 0!=this.extctx?this.extctx.set(e,i):void 0},i.prototype.get=function(e,i,s){var r=this.map[e];return null==s&&(s=[]),1!=i&&(void 0==r||null==r)&&void 0==r&&void 0!=this.extctx&&(r=this.extctx.get(e,!1,s)),void 0!=this.optionalFinder&&null==r&&t.indexOf(s,this.optionalFinder)<0&&(s.push(this.optionalFinder),r=this.optionalFinder(e)),r},i.prototype.remove=function(t){var e=this.map[t];return void 0!=e&&delete this.map[t],e},i.prototype.contains=function(e){var i=!1;return t.has(this.map,e)?!0:i?!0:void 0!=this.extctx?this.extctx.contains(e):!1},i}),define("sb4core/ClassUtil",["sb4core/Logger"],function(t){function e(){}return e.logger=new t("util",function(){return t.getDefaultPrefix()+" ClassUtil "}),e.invoke=function(t,i,s){var r=null;try{_.isArray(s)||(s=[]),e.logger._info([t,i,s]),void 0!=t&&(r=t[i].apply(t,Array.prototype.slice.call(s,0)))}catch(n){e.logger._warn(n)}return r},e.invokeWgtMethod=function(t,i,s){var r=null;try{e.logger._info([t,i,s]),void 0!=t&&(r=t.data("sb4-"+t.data("sb4type"))[i].apply(t.data("sb4-"+t.data("sb4type")),s))}catch(n){e.logger._warn(n)}return r},e.getJQueryWidgetRef=function(t){var i=null;try{i=t.data("sb4-"+t.data("sb4type"))}catch(s){e.logger._warn(s)}return i},e}),define("sb4core/SB4ParseCore",["jquery","underscore","sb4core/Logger","sb4core/DataUtil"],function(t,e,i,s){function r(t){this.engine=t,this.disableStopPoint=!1;var e=this;this.logger=new i("parse",function(){return i.getDefaultPrefix()+e.engine.id+" "})}return r.WHEN="sb4_when",r.WHEN_CONDITION="sb4_evt",r.EVT_KEY="sb4_evt_k",r.EVT_KEY2="sb4_evt_k2",r.EVTX_KEY="sb4_evtx_k",r.EVTX_KEY2="sb4_evtx_k2",r.PROCEDURES_DEFRETURN="procedures_defreturn",r.EVT_SCENE="sb4_evt_scene",r.EVT_G="sb4_evt_g",r.VAL="sb4_val",r.WGT="sb4_wgt",r.WGT_GETTER="sb4_wgt_getter",r.WGT_SETTER="sb4_wgt_setter",r.TRIGGER="sb4_trigger",r.CONTROLS_FOREACH="controls_forEach",r.CONTROLS_FORRANGE="controls_forRange",r.CONTROLS_FLOW_STATEMENTS="controls_flow_statements",r.CONTROLS_WHILE="sb4_controls_while",r.LOGIC_OPERATION="logic_operation",r.LEXICAL_VARIABLE_GET="lexical_variable_get",r.LOCAL_DECLARATION_STATEMENT="local_declaration_statement",r.EVT_TIMELINE="sb4_evt_timeline",r.EVT_PATH="sb4_evt_path",r.CONFIG_BLOCK_MAP={md:SB4API._OBJECT_KEY.MOVE_TIME,me:SB4API._OBJECT_KEY.LAYOUT_TIME,ed:SB4API._OBJECT_KEY.EFFECT_TIME,"exit.msg":SB4API._OBJECT_KEY.EXIT_MSG,"exit.url":SB4API._OBJECT_KEY.EXIT_URL,"xapi.context":SB4API._OBJECT_KEY.XAPI_CONTEXT},r.disableStopPointBlockTypeMap={lexical_variable_get:!0,logic_op2:!0,logic_operation:!0,math_compare:!0,sb4_math_arithmetic:!0,sb4_math_arithmetic2:!0,sb4_val:!0,parseWgt:!0,sb4_wgt_getter:!0,sb4_wgt_method:!0,text_compare:!0,text_join:!0,math_single:!0,lists_create_with:!0,lists_is_list:!0,lists_create_empty:!0,lists_serialize:!0,sb4_branch_numlist:!0,lists_is_in:!0,math_on_list:!0,lists_to_csv_row:!0,lists_length:!0,lists_from_csv_row:!0,lists_is_empty:!0,lists_from_csv_table:!0,lists_pick_random_item:!0,lists_lookup_in_pairs:!0,lists_position_in:!0,lists_select_item:!0,lists_pick:!0,lists_in_list:!0,lists_copy:!0,lists_random:!0,lists_compare_items:!0,conf_reset:!0,conf_change:!0,sb4_map_get:!0,sb4_map_keys:!0,sb4_map_exist:!0,sb4_map_vals:!0,sb4_map_empty:!0,sb4_map_is:!0,sb4_map_c:!0,sb4_map_froml:!0,sb4_query_map:!0,sb4_map_has:!0,sb4_map_ref:!0,sb4_map_serialize:!0},r.parserMap={lexical_variable_get:"parseLexicalVariableGet",lists_add_items:"parseListsAddItems",lists_append_list:"parseListsAppendList",lists_compare_items:"parseListsCompareItems",lists_copy:"parseListsCopy",lists_create_empty:"parseListsCreateEmpty",lists_create_with:"parseListsCreateWith",lists_from_csv_row:"parseListsFromCsvRow",lists_from_csv_table:"parseListsFromCsvTable",lists_in_list:"parseListsInList",lists_insert_item:"parseListsInsertItem",lists_is_empty:"parseListsIsEmpty",lists_is_in:"parseListsIsIn",lists_is_list:"parseListsIsList",lists_length:"parseListsLength",lists_lookup_in_pairs:"parseListsLookupInPairs",lists_pick_random_item:"parseListsPickRandomItem",lists_position_in:"parseListsPositionIn",lists_random:"parseListRandom",lists_remove_item:"parseListsRemoveItem",lists_remove_item2:"parseListsRemoveItem2",lists_remove_list:"parseListsRemoveList",lists_replace_item:"parseListsReplaceItem",lists_select_item:"parseListsSelectItem",lists_to_csv_row:"parseListsToCsvRow",lists_to_csv_table:"parseListsToCsvRow",lists_sortm:"parseListsSortm",lists_sort:"parseListsSort",lists_pick:"parsePick",lists_serialize:"parseListsSerialize",lists_deserialize:"parseListsDeserialize",local_declaration_statement:"parseLocalDeclarationStatement",logic_negate:"parseLogicNegate",logic_op2:"parseLogicOp2",logic_operation:"parseLogicOperation",math_atan2:"parseMathAtan2",math_compare:"parseMathCompare",math_divide:"parseMathDivide",math_on_list:"parseMathOnList",math_random_float:"parseMathRandomFloat",math_random_int:"parseMathRandomInt",math_single:"parseMathSingle",math_trig:"parseMathTrig",modify_value:"parseModifyValue",sb4_ajax:"parseAjax",sb4_ajax_sync:"parseAjaxSync",sb4_branch_byname:"parseBranchByName",sb4_branch_byname2:"parseBranchByName2",sb4_branch_names:"parseBranchNames",sb4_branch_numlist:"parseBranchNumList",sb4_breakpoint:"parseBreakPoint",sb4_build_query:"parseBuildQuery",sb4_close_lesson:"parseCloseLesson",sb4_color_make:"parseColorMake",sb4_color_split:"parseColorSplit",sb4_controls_if:"parseIf",sb4_exit:"parseExit",sb4_fire:"parseFire",sb4_focus:"parseFocus",sb4_func:"parseFunc",sb4_func2:"parseFunc",sb4_callproc:"parseCallProc",sb4_callproc2:"parseCallProc",sb4_goto_branch:"parseGotoBranch",sb4_goto_page:"parseGotoPage",sb4_map_clear:"parseMapClear",sb4_map_deserialize:"parseMapDeserialize",sb4_map_empty:"parseMapEmpty",sb4_map_exist:"parseMapExist",sb4_map_froml:"parseMapFroml",sb4_map_get:"parseMapGet",sb4_map_has:"parsesMapHas",sb4_map_is:"parseMapIs",sb4_map_keys:"parseMapKeys",sb4_map_vals:"parseMapVals",sb4_map_map2var:"parseMapMap2Var",sb4_map_ref:"parseMapRef",sb4_map_remove:"parseMapRemove",sb4_map_serialize:"parseMapSerialize",sb4_map_set:"parseMapSet",sb4_map_var2map:"parsesMapVar2Map",sb4_map_c:"parseMapC",sb4_map_m:"parseMapM",sb4_math_arithmetic:"parseMathArithmetic",sb4_math_arithmetic2:"parseMathArithmetic2",sb4_move_countdrag:"parseMoveCountDrag",sb4_move_finddrag:"parseMoveFindDrag",sb4_move_findzone:"parseMoveFindZone",sb4_move_inzone:"parseMoveInZone",sb4_move_isdragdrop:"parseMoveIsDragDrop",sb4_move_layout:"parseMoveLayout",sb4_move_path:"parseMovePath",sb4_move_relative:"parseMoveRelative",sb4_move_reset:"parseMoveReset",sb4_move_setdrop:"parseMoveSetDrop",sb4_move_setmdrag:"parseMoveSetMDrag",sb4_move_udlr:"parseMove",sb4_page_bynum:"parsePageByNum",sb4_pagename_bynum:"parsePageNameByNum",sb4_pagenum:"parsePageNum",sb4_print:"parsePrint",sb4_query_map:"parseQueryMap",sb4_reload_scene:"parseReloadScene",sb4_scene_count:"parseSceneCount",sb4_scene_name:"parseSceneName",sb4_show:"parseShowWithEffect",sb4_show_ind:"parseShowInd",sb4_showex:"parseShowWithEffect",sb4_showfx:"parseShowfx",sb4_tag:"parseTag",sb4_tagx:"parseTagx",sb4_timeline:"parseTimeLine",sb4_timeline_goto:"parseTimeLineGoto",sb4_trigger:"parseTrigger",sb4_val:"parseVal",sb4_volume:"parseVolume",sb4_wait:"parseWait",sb4_msg:"parseMsg",sb4_wgt:"parseWgt",sb4_wgt_getter:"parseWgtGetter",sb4_wgt_getter_a:"parseWgtGetterA",sb4_wgt_method:"parseWgtMethod",sb4_wgt_method_a:"parseWgtMethodA",sb4_wgt_setter:"parseWgtSetter",sb4_wgt_setter_a:"parseWgtSetterA",sb4_xapi_actor:"parseXApiActor",sb4_xapi_stg:"parseGetXApiSts",sb4_xapi_stmt1:"parseXapiStmt1",sb4_xapi_stmt2:"parseXapiStmt2",sb4_xapi_stmt3:"parseXapiStmt3",sb4_xapi_stmt4:"parseXapiStmt4",sb4_xapi_stmtb:"parseXapiStmtb",sb4_xapi_stmtc:"parseXapiStmtc",sb4_xapi_stmtco:"parseXapiStmtco",sb4_xapi_stmtg:"parseGetXApiStmt",sb4_xapi_stmtl:"parseXapiStmtl",sb4_xapi_stmtn:"parseXapiStmtn",sb4_xapi_stmto:"parseXapiStmto",sb4_xapi_stmtpa:"parseXapiStmtpa",sb4_xapi_stmts:"parseSetXApiStmt",sb4_xapi_stmtsc:"parseXapiStmtsc",sb4_xapi_sts:"parseSetXApiSts",sb4_xapi_stm:"parseSetXApiStm",sb4_xapi_wstmts:"parseXApiWstmts",sb4_xapi_spf:"parseXApiSpf",sb4_xapi_gpf:"parseXApiGpf",sb4_xapi_mpf:"parseXApiMpf",sb4_xapi_apfr:"parseXApiApfr",sb4_xapi_gpfr:"parseXApiGpfr",text_changeCase:"parseTextChangeCase",text_compare:"parseTextCompare",text_contains:"parseTextContains",text_isEmpty:"parseTextIsEmpty",text_join:"parseTextJoin",text_length:"parseTextLength",text_replace_all:"parseTextReplaceAll",text_segment:"parseTextSegment",text_split:"parseTextSplit",text_split_at_spaces:"parseTextSplitAtSpaces",text_trim:"parseTextTrim"},r.prototype.parse=function(e){var i=this,s=t.parseXML(e),n=t(s),o=n.find("block").filter(function(){return t(this).attr("type")==r.WHEN?this:void 0}),a=n.find("xml").first().attr("id");this.parseWhen(o,a);var h=n.find("block").filter(function(){return t(this).attr("type")==r.PROCEDURES_DEFRETURN?this:void 0});this.parseProceduresDefReturn(h);var l=n.find("block").filter(function(){return t(this).attr("type")==r.LOCAL_DECLARATION_STATEMENT?this:void 0});this.addLocalVarToEngineContext(l)},r.prototype.SIMPLE_EVTMAP={},r.prototype.SIMPLE_EVTMAP[r.EVT_SCENE]=!0,r.prototype.SIMPLE_EVTMAP[r.WHEN_CONDITION]=!0,r.prototype.SIMPLE_EVTMAP[r.EVT_KEY]=!0,r.prototype.SIMPLE_EVTMAP[r.EVT_KEY2]=!0,r.prototype.parseWhen=function(i,n){var o=this;t.each(i,function(i,a){o.logger._debug("parseWhen .... ");var h={};if("true"!=t(a).attr("disabled")){t(a).find("block").filter(function(){return r.prototype.SIMPLE_EVTMAP[t(this).attr("type")]&&"true"!=t(this).attr("disabled")}).each(function(){var e=t(this).find("mutation");if(t(this).attr("type")==r.EVT_KEY2){if(void 0!=e){var i=t(this).find("field").html();""==i&&(i="[any]");var s=e.attr("oid")+"."+i;h[s]=!0}"key_d"==e.attr("oid")?SB4API.KEY_DOWN_YES=!0:"key_u"==e.attr("oid")&&(SB4API.KEY_UP_YES=!0)}else{if(void 0!=e){var s=e.attr("oid")+"."+e.attr("v");h[s]=!0}t(this).attr("type")==r.EVT_KEY&&("key_d"==e.attr("oid")?SB4API.KEY_DOWN_YES=!0:"key_u"==e.attr("oid")&&(SB4API.KEY_UP_YES=!0))}}),t(a).find("block").filter(function(){return t(this).attr("type")==r.EVT_PATH&&"true"!=t(this).attr("disabled")?this:void 0}).each(function(){var e=t(this).find("mutation").attr("pid"),i=s.parseNumber(t(this).find("field ").html());0>=i&&(i=-1);var r=t(this).find("mutation").attr("oid")+"."+e+"_"+i;h[r]=!0}),t(a).find("block").filter(function(){return t(this).attr("type")==r.EVT_TIMELINE&&"true"!=t(this).attr("disabled")?this:void 0}).each(function(){var e=t(this).find("field").text(),i;if("end"==e)i="timeline.end";else{var r=s.parseNumber(e);0>=r&&(r=-1),i="timeline."+r}h[i]=!0}),t(a).find("block").filter(function(){return t(this).attr("type")==r.EVT_G&&"true"!=t(this).attr("disabled")?this:void 0}).each(function(){var e="flow.evt://"+t(this).find("field").html();h[e]=!0});var l=t(this).find("statement").first(),c={};t(a).find("block").filter(function(){return 0==t(this).attr("type").indexOf("sb4_evtx")&&"true"!=t(this).attr("disabled")?this:void 0}).each(function(){var e="";if("sb4_evtx_a"==t(this).attr("type"))e=t(this).find("mutation").attr("oid")+"."+t(this).find("mutation").attr("t")+"."+t(this).find("mutation").attr("v")+"."+t(this).attr("type");else if(t(this).attr("type")==r.EVTX_KEY){var i=t(this).find("mutation");e="."+i.attr("t")+"."+i.attr("v")+"."+t(this).attr("type")}else if(t(this).attr("type")==r.EVTX_KEY2){var i=t(this).find("mutation"),s=t(this).children("field[name='v']").text();""==s&&(s="[any]"),e="."+i.attr("t")+"."+s+"."+r.EVTX_KEY}else if("sb4_evtx_path"==t(this).attr("type")){var h=t(this).children("field[name='num']").text();"end"==h&&t(this).children("field[name='num']").text("-1"),e=t(this).find("mutation").attr("oid")+"."+t(this).attr("type")}else e=t(this).children("mutation").length>0?t(this).find("mutation").attr("oid")+"."+t(this).attr("type"):"."+t(this).attr("type");o.engine.registerDynamicEvent(e,t(this),l,n+"_"+t(a).attr("id"))});var u=e.keys(h);u.length>0&&o.engine.registerEvent(u,l),o.logger._debug("parseWhen end "+u)}})},r.prototype.parseProceduresDefReturn=function(e){var i=this;t.each(e,function(e,s){if(i.logger._debug("procedures .... "),"true"!=t(s).attr("disabled")){var r=t(s),n={};n.engineId=i.engine.id,n.ctx=i.engine.objctx.fork(),n.name=r.children("field[name=NAME]").text(),n.statement=r.children("statement[name=RETURN]"),n.argNames=[],t.each(r.children("mutation").children("arg"),function(e,i){n.argNames.push(t(i).attr("name"))});var o=i.engine.objctx.get("_frame");o.engine.objctx.add("[fn:"+n.name+"]",n),i.logger._debug("procedures end ")}})},r.prototype.parseBlock=function(t,i){var s=this;if(0==t.length||"true"==t.attr("disabled")){var n=t.children("next").first();return void 0!=n&&n.length>0?s.parseBlock(n.children("block"),i):i}var o=null,a=s.engine.objctx.get("flow");s.logger._debug("current flow is  "+a),"BREAK"!=a&&"CONTINUE"!=a&&("true"==t.attr("disabled")||null!=r.parserMap[t.attr("type")]&&(o=s[r.parserMap[t.attr("type")]].apply(s,[t,i]))),t.attr("type")==r.CONTROLS_FOREACH?o=s.parseControlsForEach(t,i):t.attr("type")==r.CONTROLS_FORRANGE?o=s.parseControlsForRange(t,i):t.attr("type")==r.CONTROLS_FLOW_STATEMENTS?o=s.parseControlsFlowStatements(t,i):t.attr("type")==r.CONTROLS_WHILE&&(o=s.parseControlsWhile(t,i)),null==o&&(o=i);var h=null;h=s.disableStopPoint||e.has(r.disableStopPointBlockTypeMap,t.attr("type"))?o:s.createStopPoint(o,t);var n=t.children("next").first();return void 0!=n&&n.length>0?s.parseBlock(n.children("block"),h):h},r.prototype.arrayToObject=function(i){var s={};return e.isArray(i)&&!e.isEmpty(i)&&t.each(i,function(t,i){e.isArray(i)&&i.length>=2&&(s[i[0]]=i[1])}),s},r.prototype.createStopPoint=function(e,i){var s=this,r=e.then(function(e){var r=t.Deferred(),n=r.then(function(){return SB4API.debug&&null!=i&&s.engine._recordBlockResult(i.attr("id")+"."+i.attr("type"),e),e});return s.engine.addStopPoint(r),"busy"==s.engine.status&&(s.engine.status="idle"),n});return r},r.prototype.setDisableStopPoint=function(t){this.disableStopPoint=t},r.prototype.addLocalVarToEngineContext=function(e){var i=this;t.each(e,function(e,s){if(i.logger._debug("procedures addLocalVarToEngineContext .... "),"true"!=t(s).attr("disabled")){var r=t(s),n=r.children("field");t.each(n,function(e,s){var r=t(s).html();i.engine.objctx.add("^SB4_local_var_prefix_"+r,"")}),i.logger._debug("procedures addLocalVarToEngineContext end ")}})},r}),define("sb4core/DeferredTask",["sb4core/Logger"],function(t){function e(e,i,s){this.c=e,this.tail=i,this.id=s,this.logger=new t("task",function(){return t.getDefaultPrefix()+s+" "})}return e.prototype._process=function(){if(this.logger._debug("tail state is  : "+this.tail.state()),"pending"==this.c.state())this.c.resolve();else if("resolved"==this.tail.state()||"rejected"==this.tail.state())return!0},e}),function(t){"function"==typeof define&&define.amd?define("jqueryui/effect",["jquery"],t):t(jQuery)}(function(t){var e="ui-effects-",i=t;return t.effects={effect:{}},function(t,e){function i(t,e,i){var s=c[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:s.max<t?s.max:t)}function s(e){var i=h(),s=i._rgba=[];return e=e.toLowerCase(),f(a,function(t,r){var n,o=r.re.exec(e),a=o&&r.parse(o),h=r.space||"rgba";return a?(n=i[h](a),i[l[h].cache]=n[l[h].cache],s=i._rgba=n._rgba,!1):void 0}),s.length?("0,0,0,0"===s.join()&&t.extend(s,p.transparent),i):p[e]}function r(t,e,i){return i=(i+1)%1,1>6*i?t+(e-t)*i*6:1>2*i?e:2>3*i?t+(e-t)*(2/3-i)*6:t}var n="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",o=/^([\-+])=\s*(\d+\.?\d*)/,a=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],h=t.Color=function(e,i,s,r){return new t.Color.fn.parse(e,i,s,r)},l={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},c={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},u=h.support={},d=t("<p>")[0],p,f=t.each;d.style.cssText="background-color:rgba(1,1,1,.5)",u.rgba=d.style.backgroundColor.indexOf("rgba")>-1,f(l,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),h.fn=t.extend(h.prototype,{parse:function(r,n,o,a){if(r===e)return this._rgba=[null,null,null,null],this;(r.jquery||r.nodeType)&&(r=t(r).css(n),n=e);var c=this,u=t.type(r),d=this._rgba=[];return n!==e&&(r=[r,n,o,a],u="array"),"string"===u?this.parse(s(r)||p._default):"array"===u?(f(l.rgba.props,function(t,e){d[e.idx]=i(r[e.idx],e)}),this):"object"===u?(r instanceof h?f(l,function(t,e){r[e.cache]&&(c[e.cache]=r[e.cache].slice())}):f(l,function(e,s){var n=s.cache;f(s.props,function(t,e){if(!c[n]&&s.to){if("alpha"===t||null==r[t])return;c[n]=s.to(c._rgba)}c[n][e.idx]=i(r[t],e,!0)}),c[n]&&t.inArray(null,c[n].slice(0,3))<0&&(c[n][3]=1,s.from&&(c._rgba=s.from(c[n])))}),this):void 0},is:function(t){var e=h(t),i=!0,s=this;return f(l,function(t,r){var n,o=e[r.cache];return o&&(n=s[r.cache]||r.to&&r.to(s._rgba)||[],f(r.props,function(t,e){return null!=o[e.idx]?i=o[e.idx]===n[e.idx]:void 0})),i}),i},_space:function(){var t=[],e=this;return f(l,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=h(t),r=s._space(),n=l[r],o=0===this.alpha()?h("transparent"):this,a=o[n.cache]||n.to(o._rgba),u=a.slice();return s=s[n.cache],f(n.props,function(t,r){var n=r.idx,o=a[n],h=s[n],l=c[r.type]||{};null!==h&&(null===o?u[n]=h:(l.mod&&(h-o>l.mod/2?o+=l.mod:o-h>l.mod/2&&(o-=l.mod)),u[n]=i((h-o)*e+o,r)))}),this[r](u)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),r=h(e)._rgba;return h(t.map(i,function(t,e){return(1-s)*r[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),h.fn.parse.prototype=h.fn,l.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/255,i=t[1]/255,s=t[2]/255,r=t[3],n=Math.max(e,i,s),o=Math.min(e,i,s),a=n-o,h=n+o,l=.5*h,c,u;return c=o===n?0:e===n?60*(i-s)/a+360:i===n?60*(s-e)/a+120:60*(e-i)/a+240,u=0===a?0:.5>=l?a/h:a/(2-h),[Math.round(c)%360,u,l,null==r?1:r]},l.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],n=t[3],o=.5>=s?s*(1+i):s+i-s*i,a=2*s-o;return[Math.round(255*r(a,o,e+1/3)),Math.round(255*r(a,o,e)),Math.round(255*r(a,o,e-1/3)),n]},f(l,function(s,r){var n=r.props,a=r.cache,l=r.to,c=r.from;h.fn[s]=function(s){if(l&&!this[a]&&(this[a]=l(this._rgba)),s===e)return this[a].slice();var r,o=t.type(s),u="array"===o||"object"===o?s:arguments,d=this[a].slice();return f(n,function(t,e){var s=u["object"===o?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(r=h(c(d)),r[a]=d,r):h(d)},f(n,function(e,i){h.fn[e]||(h.fn[e]=function(r){var n=t.type(r),a="alpha"===e?this._hsla?"hsla":"rgba":s,h=this[a](),l=h[i.idx],c;return"undefined"===n?l:("function"===n&&(r=r.call(this,l),n=t.type(r)),null==r&&i.empty?this:("string"===n&&(c=o.exec(r),c&&(r=l+parseFloat(c[2])*("+"===c[1]?1:-1))),h[i.idx]=r,this[a](h)))})})}),h.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,r){var n,o,a="";if("transparent"!==r&&("string"!==t.type(r)||(n=s(r)))){if(r=h(n||r),!u.rgba&&1!==r._rgba[3]){for(o="backgroundColor"===i?e.parentNode:e;(""===a||"transparent"===a)&&o&&o.style;)try{a=t.css(o,"backgroundColor"),o=o.parentNode}catch(l){}r=r.blend(a&&"transparent"!==a?a:"_default")}r=r.toRgbaString()}try{e.style[i]=r}catch(l){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=h(e.elem,i),e.end=h(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},h.hook(n),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},p=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(i),function(){function e(e){var i,s,r=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,n={};if(r&&r.length&&r[0]&&r[r[0]])for(s=r.length;s--;)i=r[s],"string"==typeof r[i]&&(n[t.camelCase(i)]=r[i]);else for(i in r)"string"==typeof r[i]&&(n[i]=r[i]);return n}function s(e,i){var s={},r,o;for(r in i)o=i[r],e[r]!==o&&(n[r]||(t.fx.step[r]||!isNaN(parseFloat(o)))&&(s[r]=o));return s}var r=["add","remove","toggle"],n={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,s){t.fx.step[s]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(i.style(t.elem,s,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(i,n,o,a){var h=t.speed(n,o,a);return this.queue(function(){var n=t(this),o=n.attr("class")||"",a,l=h.children?n.find("*").addBack():n;l=l.map(function(){var i=t(this);return{el:i,start:e(this)}}),a=function(){t.each(r,function(t,e){i[e]&&n[e+"Class"](i[e])})},a(),l=l.map(function(){return this.end=e(this.el[0]),this.diff=s(this.start,this.end),this}),n.attr("class",o),l=l.map(function(){var e=this,i=t.Deferred(),s=t.extend({},h,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,l.get()).done(function(){a(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),h.complete.call(n[0])})})},t.fn.extend({addClass:function(e){return function(i,s,r,n){return s?t.effects.animateClass.call(this,{add:i},s,r,n):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,r,n){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,r,n):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(e){return function(i,s,r,n,o){return"boolean"==typeof s||void 0===s?r?t.effects.animateClass.call(this,s?{add:i}:{remove:i},r,n,o):e.apply(this,arguments):t.effects.animateClass.call(this,{toggle:i},s,r,n)}}(t.fn.toggleClass),switchClass:function(e,i,s,r,n){return t.effects.animateClass.call(this,{add:i,remove:e},s,r,n)}})}(),function(){function i(e,i,s,r){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(r=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(r=s,s=i,i={}),t.isFunction(s)&&(r=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=r||i.complete,e}function s(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}t.extend(t.effects,{version:"1.11.2",save:function(t,i){for(var s=0;s<i.length;s++)null!==i[s]&&t.data(e+i[s],t[0].style[i[s]])},restore:function(t,i){var s,r;for(r=0;r<i.length;r++)null!==i[r]&&(s=t.data(e+i[r]),void 0===s&&(s=""),t.css(i[r],s))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),r={width:e.width(),height:e.height()},n=document.activeElement;try{n.id}catch(o){n=document.body}return e.wrap(s),(e[0]===n||t.contains(e[0],n))&&t(n).focus(),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(r),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).focus()),e},setTransition:function(e,i,s,r){return r=r||{},t.each(i,function(t,i){var n=e.cssUnit(i);n[0]>0&&(r[i]=n[0]*s+n[1])}),r}}),t.fn.extend({effect:function(){function e(e){function i(){t.isFunction(n)&&n.call(r[0]),t.isFunction(e)&&e()}var r=t(this),n=s.complete,a=s.mode;(r.is(":hidden")?"hide"===a:"show"===a)?(r[a](),i()):o.call(r[0],s,i)}var s=i.apply(this,arguments),r=s.mode,n=s.queue,o=t.effects.effect[s.effect.toLowerCase()];return t.fx.off||!o?r?this[r](s.duration,s.complete):this.each(function(){s.complete&&s.complete.call(this)}):n===!1?this.each(e):this.queue(n||"fx",e)},show:function(t){return function(e){if(s(e))return t.apply(this,arguments);var r=i.apply(this,arguments);return r.mode="show",this.effect.call(this,r)}}(t.fn.show),hide:function(t){return function(e){if(s(e))return t.apply(this,arguments);var r=i.apply(this,arguments);return r.mode="hide",this.effect.call(this,r)}}(t.fn.hide),toggle:function(t){return function(e){if(s(e)||"boolean"==typeof e)return t.apply(this,arguments);var r=i.apply(this,arguments);return r.mode="toggle",this.effect.call(this,r)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s}})}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)
}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}(),t.effects}),define("sb4core/parse/core/lexical_variable_get",["sb4core/SB4ParseCore"],function(t){t.prototype.parseLexicalVariableGet=function(t,e){var i=this,s=e.then(function(){i.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var e=t.children("field[name=VAR]").text();return i.engine.objctx.get(e)});return s}}),define("sb4core/parse/core/lexical_variable_set",["sb4core/SB4ParseCore","sb4core/DataUtil"],function(t,e){t.parserMap.lexical_variable_set="parseLexicalVariableSet",t.prototype.parseLexicalVariableSet=function(t,i){var s=this,r=i.then(function(){s.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var i=t.children("field[name=VAR]").text(),r=$.Deferred(),n=s.parseBlock(t.children("value[name=VALUE]").find("block:first"),r).then(function(t){if(0==i.indexOf("global ")){s.engine.objctx.set(i,t);var r=i.substring("global ".length),n=s.engine.objctx.get("_frame");_.each(n.engine.subEngines,function(t){var i=t.objctx.get("[var_widget_id_map]");_.has(i,r)&&_.each(i[r],function(i){var s=t.objctx.get(i);null!=s&&e.isWgt(s)&&s._firePaintRequest({updateTextByVar:""})})})}else{s.engine.objctx.contains(i)?s.engine.objctx.set(i,t):s.engine.objctx.add(i,t),s.engine.objctx.set("^SB4_local_var_prefix_"+i,t);var r=i,o=s.engine.objctx.get("[var_widget_id_map]");_.has(o,r)&&_.each(o[r],function(t){var i=s.engine.objctx.get(t);null!=i&&e.isWgt(i)&&i._firePaintRequest({updateTextByVar:""})})}});return r.resolve(),n});return r}}),define("sb4core/parse/core/logic_op2",["sb4core/SB4ParseCore","sb4core/DataUtil"],function(t,e){t.prototype.parseLogicOp2=function(t,i){var s=this,r=i.then(function(){s.logger._debug(t.attr("id")+"."+t.attr("type")+" start ... ");var i=t.children("field[name=OP]").text(),r=t.children("value");if(r.length>0){var n=[],o=$.Deferred(),a=$.Deferred();o.then(function(){$.each(r,function(t,i){var o=$.Deferred();s.parseBlock($(i).find("block:first"),o).then(function(t){n.push(e.parseBoolean(t)),n.length==r.length&&a.resolve()}),o.resolve()})});var h=a.then(function(){if(n.length>=1){if("AND"==i){var t=!0;return $.each(n,function(e,i){return i?void 0:(t=!1,!1)}),t}var t=!1;return $.each(n,function(e,i){return i?(t=!0,!1):void 0}),t}return!1});return o.resolve(),h}return!1});return r}}),define("sb4core/parse/core/logic_operation",["sb4core/SB4ParseCore","sb4core/DataUtil"],function(t,e){t.prototype.parseLogicOperation=function(t,i){var s=this,r=i.then(function(){s.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var i=$.Deferred(),r=$.Deferred(),n=t.children("field[name=OP]").text(),o=s.parseBlock(t.children("value[name=A]").find("block:first"),i),a=s.parseBlock(t.children("value[name=B]").find("block:first"),r);i.resolve();var h=$.when(o).then(function(i){s.logger._debug(t.attr("id")+"."+t.attr("type")+" op1 = "+i);var o=e.parseBoolean(i);return"AND"==n?o?(r.resolve(),$.when(a).then(function(i){return s.logger._debug(t.attr("id")+"."+t.attr("type")+" op2 = "+i),e.parseBoolean(i)})):!1:o?!0:(r.resolve(),$.when(a).then(function(i){return s.logger._debug(t.attr("id")+"."+t.attr("type")+" op2 = "+i),e.parseBoolean(i)}))});return h});return r}}),define("sb4core/parse/core/math_compare",["sb4core/SB4ParseCore","sb4core/DataUtil"],function(t,e){t.prototype.parseMathCompare=function(t,i){var s=this,r=i.then(function(){s.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var i=$.Deferred(),r=$.Deferred(),n=t.children("field[name=OP]").text(),o=s.parseBlock(t.children("value[name=A]").find("block:first"),i),a=s.parseBlock(t.children("value[name=B]").find("block:first"),r);i.resolve(),r.resolve();var h=$.when(o,a).then(function(i,r){if(s.logger._debug(t.attr("id")+"."+t.attr("type")+" "+i+" : "+r),null==n)return s.logger._warn(t.attr("id")+"."+t.attr("type")+" op is error "),!1;if("S"==n.charAt(n.length-1)){if(i=e.parseString(i),r=e.parseString(r),"EQS"==n)return i==r;if("NEQS"==n)return i!=r;if("LTS"==n)return r>i;if("LTES"==n)return r>=i;if("GTS"==n)return i>r;if("GTES"==n)return i>=r}else{if(_.isObject(i)||_.isObject(r))return i instanceof $.Color||r instanceof $.Color?(i=e.parseColor(i),r=e.parseColor(r),"EQ"==n||"LTE"==n||"GTE"==n?i.is(r):"NEQ"==n?!i.is(r):!1):"EQ"==n||"LTE"==n||"GTE"==n?i===r:"NEQ"==n?i!==r:!1;if(null==i&&(i=""),null==r&&(r=""),"EQ"==n)return i==r;if("NEQ"==n)return i!=r;if("LT"==n)return r>i;if("LTE"==n)return r>=i;if("GT"==n)return i>r;if("GTE"==n)return i>=r}});return h});return r}}),define("sb4core/parse/core/sb4_controls_if",["sb4core/SB4ParseCore","sb4core/DataUtil"],function(t,e){t.prototype.parseIf=function(t,i){var s=this;s.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var r=1,n=t.find("mutation").attr("elseif");n&&(r+=e.parseInt(n));var o=$.Deferred(),a=function(i,n){if(r>i){var h=t.children("statement[name=DO"+i+"]"),l=t.children("value[name=IF"+i+"]").find("block:first");s.parseBlock(l,n).then(function(t){if(e.isTrue(t)){var r=$.Deferred(),n=s.parseBlock(h.find("block:first"),r).then(function(){o.resolve()});return r.resolve(),n}var l=$.Deferred();return l.resolve(),i+=1,a(i,l)})}else{var c=t.children("statement[name=ELSE]");if(void 0!=c&&c.length>0){var u=$.Deferred(),d=s.parseBlock(c.find("block:first"),u).then(function(){o.resolve()});return u.resolve(),d}o.resolve()}},h=a(0,i);return o}}),define("sb4core/parse/core/sb4_goto_branch",["sb4core/SB4ParseCore"],function(t){t.prototype.parseGotoBranch=function(t,e){var i=this,s=e.then(function(){i.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var e={};e.v=t.children("field[name=v]").text();var s=i.engine.objctx.get("_frame"),r=$.Deferred();return r.reject(),r.fail(function(){i.engine.interrupt("gotoPage"),s.onEnginePageEvent(t.attr("type"),e)}),r});return s}}),define("sb4core/parse/core/sb4_goto_page",["sb4core/SB4ParseCore","sb4core/DataUtil"],function(t,e){t.prototype.parseGotoPage=function(t,i){var s=this,r=i.then(function(){s.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var i={},r=s.engine.objctx.get("_frame"),n=t.children("field[name=v]").html();i.id=e.parseString(n);var o=$.Deferred();return o.reject(),o.fail(function(){s.engine.interrupt("gotoPage"),r.onEnginePageEvent("sb4_goto_scene_by_id",i)}),o});return r}}),define("sb4core/parse/core/sb4_math_arithmetic",["sb4core/SB4ParseCore","sb4core/DataUtil"],function(t,e){t.prototype.parseMathArithmetic=function(t,i){var s=this,r=i.then(function(){s.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var i=$.Deferred(),r=$.Deferred(),n=t.children("field[name=OP]").text(),o=s.parseBlock(t.children("value[name=A]").find("block:first"),i),a=s.parseBlock(t.children("value[name=B]").find("block:first"),r);i.resolve(),r.resolve();var h=$.when(o,a).then(function(i,r){s.logger._debug(t.attr("id")+"."+t.attr("type")+" "+i+" : "+r);var o=e.parseNumber(i),a=e.parseNumber(r);return"ADD"==n?o+a:"MINUS"==n?o-a:"MULTIPLY"==n?o*a:"DIVIDE"==n?o/a:"POWER"==n?Math.pow(o,a):(s.logger._warn(t.attr("id")+"."+t.attr("type")+" op is error "),!1)});return h});return r}}),define("sb4core/parse/core/sb4_math_arithmetic2",["sb4core/SB4ParseCore","sb4core/DataUtil"],function(t,e){t.prototype.parseMathArithmetic2=function(t,i){var s=this,r=i.then(function(){s.logger._debug(t.attr("id")+"."+t.attr("type")+" start ... ");var i=t.children("field[name=OP]").text(),r=t.children("value");if(r.length>0){var n=[],o=$.Deferred(),a=$.Deferred(),h=0;o.then(function(){$.each(r,function(t,i){var o=$.Deferred();s.parseBlock($(i).find("block:first"),o).then(function(i){n[t]=e.parseNumber(i),h+=1,h==r.length&&a.resolve()}),o.resolve()})});var l=a.then(function(){if(n.length>=2){if("ADD"==i){var e=n.shift();return $.each(n,function(t,i){e+=i}),e}if("MINUS"==i){var e=n.shift();return $.each(n,function(t,i){e-=i}),e}if("MULTIPLY"==i){var e=n.shift();return $.each(n,function(t,i){e*=i}),e}if("DIVIDE"==i){var e=n.shift();return $.each(n,function(t,i){e/=i}),e}if("POWER"==i){var e=n.shift();return $.each(n,function(t,i){e=Math.pow(e,i)}),e}return s.logger._warn(t.attr("id")+"."+t.attr("type")+" op is error "),!1}return 1==n.length?n[0]:0});return o.resolve(),l}});return r}}),define("sb4core/parse/core/sb4_showex",["sb4core/SB4ParseCore","sb4core/ClassUtil","sb4core/DataUtil"],function(t,e,i){t.prototype.parseShowWithEffect=function(t,s){var r=this,n=s.then(function(){r.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var s=t.children("field[name=OP]").text().trim(),n=t.children("field[name=EFFECT]").text(),o=$.Deferred(),a=r.engine.objctx.get(SB4API._OBJECT_KEY.EFFECT_TIME),h=[],l=0,c=t.children("value[name=WGT]").children("block");if(c.length>0){$.each(c,function(t,e){var i=$.Deferred();r.parseBlock($(e),i).then(function(t){h=h.concat(t),l+=1,l==c.length&&o.resolve()}),i.resolve()});var u=o.then(function(){return _.union(h)}).then(function(t){var r=i.parseWidgetArray(t);$.each(r,function(t,i){var r=[];r.push(n),r.push(""),r.push(a),e.invoke(i,s,r)})});return u}});return n}}),define("sb4core/parse/core/sb4_val",["sb4core/SB4ParseCore","sb4core/DataUtil"],function(t,e){t.prototype.parseVal=function(t,i){var s=this,r=i.then(function(){s.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var i=t.find("mutation").attr("vtype"),r=t.children("field[name=V]").text();return"BOOL"==i?r=e.parseBoolean(r):"TXT"==i?r=e.parseString(r):"COLOR"==i?r=e.parseString(r):"NUM"==i&&(r=e.parseNumber(r)),s.logger._debug(t.attr("id")+"."+t.attr("type")+" "+i+" parseVal  value= "+r),r});return r}}),define("sb4core/parse/core/sb4_wgt",["sb4core/SB4ParseCore"],function(t){t.prototype.parseWgt=function(t,e){var i=this,s=e.then(function(){i.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var e=t.find("mutation").attr("oid");return i.logger._debug(t.attr("id")+"."+t.attr("type")+" parseWgtGetter ..."+e),i.engine.objctx.get(e)});return s}}),define("sb4core/parse/core/sb4_wgt_getter",["sb4core/SB4ParseCore","sb4core/ClassUtil"],function(t,e){t.prototype.parseWgtGetter=function(t,i){var s=this,r=i.then(function(){s.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var i=t.find("mutation").attr("oid"),r="get"+_.str.capitalize(t.find("mutation").attr("m"));s.logger._debug(t.attr("id")+"."+t.attr("type")+" parseWgtGetter ..."+i+" "+r);var n=s.engine.objctx.get(i),o=e.invoke(n,r,[]);return o});return r}}),define("sb4core/parse/core/sb4_wgt_method",["sb4core/SB4ParseCore","sb4core/ClassUtil"],function(t,e){t.prototype.parseWgtMethod=function(t,i){var s=this,r=i.then(function(){s.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var i=t.find("mutation").attr("oid"),r=t.find("mutation").attr("m"),n=[];$.each(t.children(),function(t,e){("field"==$(e).prop("tagName")||"value"==$(e).prop("tagName"))&&n.push(e)}),n=_.sortBy(n,function(t){return $(t).attr("name")});var o=$.Deferred(),a=[],h=$.Deferred(),l=h;$.each(n,function(t,e){l=l.then(function(t){var i=$(e).attr("name"),r=i.split("-")[1];if("value"==$(e).prop("tagName")){var n=$.Deferred(),o=s.parseBlock($(e).find("block:first"),n).then(function(t){a[r]=t});return n.resolve(),o}a[r]=$(e).html()})}),s.logger._debug(t.attr("id")+"."+t.attr("type")+" parseWgtMethod ..."+i+" "+r+" ",a);var c=o.then(function(){var t=s.engine.objctx.get(i);return e.invoke(t,r,a)});return l.then(function(){o.resolve()}),h.resolve(),c});return r}}),define("sb4core/parse/core/sb4_wgt_setter",["sb4core/SB4ParseCore","sb4core/ClassUtil"],function(t,e){t.prototype.parseWgtSetter=function(t,i){var s=this,r=i.then(function(){s.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var i=t.find("mutation").attr("oid"),r="set"+_.str.capitalize(t.find("mutation").attr("m"));s.logger._debug(t.attr("id")+"."+t.attr("type")+" parseWgtSetter ..."+i+" "+r);var n=t.children("value").find("block:first"),o=$.Deferred(),a=s.parseBlock(n,o).then(function(t){var n=s.engine.objctx.get(i);e.invoke(n,r,[t])});return o.resolve(),a});return r}}),define("sb4core/parse/core/text_compare",["sb4core/SB4ParseCore","sb4core/DataUtil"],function(t,e){t.prototype.parseTextCompare=function(t,i){var s=this,r=i.then(function(){s.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var i=t.children("field[name=OP]").text().trim(),r=$.Deferred(),n=s.parseBlock(t.children("value[name=TEXT1]").find("block:first"),r),o=$.Deferred(),a=s.parseBlock(t.children("value[name=TEXT2]").find("block:first"),o),h=$.when(n,a).then(function(r,n){s.logger._debug(t.attr("id")+"."+t.attr("type")+" "+r+" parseTextCompare "+n);var o=e.parseString(r),a=e.parseString(n);return"LT"==i?a>o:"EQUAL"==i?o==a:"GT"==i?o>a:(s.logger._debug(t.attr("id")+"."+t.attr("type")+" op is error "),!1)});return r.resolve(),o.resolve(),h});return r}}),define("sb4core/parse/core/text_join",["sb4core/SB4ParseCore","sb4core/DataUtil"],function(t,e){t.prototype.parseTextJoin=function(t,i){var s=this,r=i.then(function(){s.logger._info(t.attr("id")+"."+t.attr("type")+" start ... ");var i=t.children("value");if(i.length>0){var r="",n=head=$.Deferred(),o=$.Deferred(),a=0;$.each(i,function(t,h){n=s.parseBlock($(h).find("block:first"),n).then(function(t){r=_.str.join("",r,e.parseString(t)),a+=1,a==i.length&&o.resolve()})}),head.resolve();var h=o.then(function(){return r});return h}});return r}}),define("sb4core/parse/parse_core",["sb4core/parse/core/lexical_variable_get","sb4core/parse/core/lexical_variable_set","sb4core/parse/core/logic_op2","sb4core/parse/core/logic_operation","sb4core/parse/core/math_compare","sb4core/parse/core/sb4_controls_if","sb4core/parse/core/sb4_goto_branch","sb4core/parse/core/sb4_goto_page","sb4core/parse/core/sb4_math_arithmetic","sb4core/parse/core/sb4_math_arithmetic2","sb4core/parse/core/sb4_showex","sb4core/parse/core/sb4_val","sb4core/parse/core/sb4_wgt","sb4core/parse/core/sb4_wgt_getter","sb4core/parse/core/sb4_wgt_method","sb4core/parse/core/sb4_wgt_setter","sb4core/parse/core/text_compare","sb4core/parse/core/text_join"],function(){}),define("sb4core/SB4Engine",["jquery","underscore","sb4core/Logger","sb4core/ClassUtil","sb4core/DataUtil","sb4core/SB4ParseCore","sb4core/DeferredTask","underscore_str","jqueryui/core","jqueryui/effect","sb4core/parse/parse_core"],function(t,e,i,s,r,n,o){function a(t,e,s,o){void 0==t&&(t=""),this.id=t,void 0==t&&(t="-"),this.name=o,this.timer=-1,this.tick=r.parseNumber(e),this.tick=this.tick<=0?8:this.tick,e>a.MAX_TITCK&&(this.tick=a.MAX_TITCK),this.logger=new i("engine",function(){return i.getDefaultPrefix()+t+" "+o+" "}),this.status=a.STATUS_STOP,this.taskQueue=new h,this.subEngines=[],this.objctx=s,this.initObjctx=s,this.idleCount=0,this.maxIdleCount=1e3,this.startFlag=!0,this.results=[],this.eventMap={},this.dynamicEventMap={},this.eventIdleCount=0,this.maxEventIdleCount=10,this.parse=new n(this),this.eventQueue=[],this.lastParsedEventQueue=[],this.lastBlockResultQueue=[],this.statementQueue=[],this.listenerQueue=[],this.stopPoints=[],this.burst=a.BURST,this.isFork=!1,this.logger._info("SB4Engine init .. "+t)}function h(){this.queue=[]}function l(t,e,i,s){this.c=t,this.method=e,this.arguments=i,this.id=s}return a.BURST=20,a.STATUS_STOP="stop",a.STATUS_SLEEP="sleep",a.STATUS_DEAD="dead",a.STATUS_IDLE="idle",a.STATUS_BUSY="busy",a.MODE_GOTO_PAGE="gotoPage",a.MAX_TITCK=50,a.prototype._workProcess=function(){var t=this;if(this.status==a.STATUS_DEAD)return this.logger._debug("SB4Engine is dead, ignoring _work tick"),!1;if(this.status==a.STATUS_BUSY)return this.logger._debug(" is busy"),!1;if(this.status==a.STATUS_STOP)return this.logger._debug(" is stop"),!1;{if(!(this.taskQueue.length()>0)){if(this.statementQueue.length>0){this.idleCount=0;var i=this.statementQueue.shift();return this._processStatement(i),!1}var s=!1;if(this.eventQueue.length>0){var r=this.eventQueue.shift();this._parseEvent(r)}else this.idleCount=this.idleCount+1,s=!0;return this.idleCount>this.maxIdleCount&&(this.status=a.STATUS_SLEEP,clearInterval(this.timer),clearTimeout(this.timer),this.timer=-1,s=!0),!s}this.status=a.STATUS_BUSY,this.idleCount=0;var n=this.taskQueue.first(),o=e.clone(this.stopPoints);if(this.stopPoints=[],e.size(o)>0&&e.each(o,function(e,i){t.logger._debug("stop point deferred resolve"),e.resolve()}),this.status==a.STATUS_STOP)return this.logger._debug(" is sleep after resolve stop point deferred"),!1;try{n._process()&&this.taskQueue&&(this.taskQueue.shift(),this.taskQueue.length()>0?(this.status=a.STATUS_BUSY,this.idleCount=0,o=e.clone(this.stopPoints),this.stopPoints=[],e.size(o)>0&&e.each(o,function(e,i){t.logger._debug("stop point deferred resolve"),e.resolve()}),n=this.taskQueue.first(),(null==n||n._process())&&(this.status=a.STATUS_IDLE)):this.status=a.STATUS_IDLE)}catch(h){if(null!=this.taskQueue&&this.taskQueue.length()>0){var l=this.taskQueue.shift();e.isFunction(l.c.reject)&&(l.c.reject(),this.logger._warn("remove error task"))}this.status!=a.STATUS_DEAD&&(this.status=a.STATUS_IDLE),this.logger._warn("engine work process error: "+h.name+" : "+h.message)}}},a.prototype.start=function(i){if(this.logger._debug(" start, isParentCall: "+i+" ,startFlag:"+this.startFlag),this.idleCount=0,i||(this.startFlag=!0),!(i&&!this.startFlag||this.status!=a.STATUS_SLEEP&&this.status!=a.STATUS_STOP)){var s=this.status==a.STATUS_STOP&&!this.isFork;this.status=a.STATUS_IDLE;var n=this;this.timer=setInterval(function(){for(var t=n.burst;--t>0;){var e=n._workProcess();if(0==e)break}},this.tick),s&&e.each(e.values(this.initObjctx.map),function(t,i){r.isWgt(t)&&e.isFunction(t._play)&&t._play()})}this.status!=a.STATUS_DEAD&&t.each(this.subEngines,function(t,e){(e.status==a.STATUS_SLEEP||this.status==a.STATUS_STOP)&&e.start(!0)})},a.prototype.stop=function(i){if(this.logger._info(" stop "+i),this.status!=a.STATUS_DEAD&&t.each(this.subEngines,function(t,e){e.stop(!0)}),i||(this.startFlag=!1),this.status!=a.STATUS_DEAD){if(this.status!=a.STATUS_STOP&&!this.isFork){var s=this;e.each(e.keys(this.initObjctx.map),function(t,i){var n=s.initObjctx.map[t];r.isWgt(n)&&n.options._i==t&&e.isFunction(n._stop)&&n._stop()})}this.status=a.STATUS_STOP,clearInterval(this.timer),clearTimeout(this.timer),this.timer=-1,this.idleCount=0}},a.prototype.destroy=function(){this.logger._info(" destroy "),this.status!=a.STATUS_DEAD&&t.each(this.subEngines,function(t,e){e.destroy()}),this.stop(),this.status=a.STATUS_DEAD,this.timer=void 0,this.taskQueue=void 0,this.subEngines=void 0,this.objctx=void 0,this.eventQueue=void 0,this.statementQueue=void 0,this.eventMap=void 0,this.dynamicEventMap=void 0,this.parse=void 0,this.lastParsedEventQueue=void 0,this.lastBlockResultQueue=void 0,this.initObjctx=void 0,this.listenerQueue=void 0,this.results=void 0},a.prototype.addEngine=function(t){this.subEngines.push(t)},a.prototype.addSubEngine=function(t,i){e.str.isBlank(t)&&(t=e.uniqueId(this.id+"_"));var s=new a(t,1.1*this.tick,this.objctx.fork(),i);return this.subEngines.push(s),s},a.prototype._purgeSubEngine=function(){if(this.status!=a.STATUS_DEAD)for(var t=this.subEngines.length-1;t>=0;t--)this.subEngines[t].status==a.STATUS_DEAD&&(this.logger._debug("  _purgeSubEngine, removed "+this.subEngines[t].id),this.subEngines.splice(t,1))},a.prototype.isSubEnginesInState=function(t){var i=e.find(this.subEngines,function(e){return void 0!=e&&e.status!=t?!0:void 0});return void 0!=i?!1:!0},a.prototype.getSubEngineByID=function(i){var s;return!e.str.isBlank(i)&&e.size(this.subEngines)>0&&t.each(this.subEngines,function(t,e){i==e.id&&(s=e)}),s},a.prototype._longTaskFinish=function(t){this.logger._debug("_longTaskFinish ",t,this.results),this.status!=a.STATUS_DEAD&&(void 0!=t&&this.results.push(t),this.status=a.STATUS_IDLE)},a.prototype.addEngineEventListener=function(t){e.contains(this.listenerQueue,t)||"onEngineEvent"in t&&this.listenerQueue.push(t)},a.prototype.removeEngineEventListener=function(e){var i=this;t.each(this.listenerQueue,function(t,s){return s===e?(i.listenerQueue.splice(t,1),!1):void 0})},a.prototype.registerEvent=function(e,i){if(this.status!=a.STATUS_DEAD){var s=this;t.each(e,function(e,r){var n=s.eventMap[r];if(void 0==n&&(n=[],s.eventMap[r]=n),t.isArray(i))for(var o=0;o<i.length;o++)i[o].id=r,n.push(i[o]);else i.id=r,n.push(i)})}},a.prototype.registerDynamicEvent=function(t,e,i,s){if(this.status!=a.STATUS_DEAD){var r={};r.condition=e,r.expr=i,r.whenBlockId=s;var n=this.dynamicEventMap[t];n?n.push(r):(n=[],n.push(r),this.dynamicEventMap[t]=n)}},a.prototype.addEvent=function(i,s,r){var n=this;if(this.status!=a.STATUS_DEAD){if(SB4API.disableEngineAddEvent)return void this.logger._debug(" disable event ",i,s,r);this.eventQueue.push([i,s,r]),this.logger._info(" addEvent ",i,s,r),"flow"==i&&e.string.startsWith(s,"evt://")&&null!=r&&r.broadcast&&SB4API.onGlobalEventListener(i+"."+s,r["[evtval]"]),null!=r&&r.broadcast?(this.status==a.STATUS_SLEEP&&this.start(),t.each(this.listenerQueue,function(t,e){e.onEngineEvent(n,i,s,r)})):"flow"==i&&"load"==s||(this.status==a.STATUS_SLEEP&&this.start(),t.each(this.listenerQueue,function(t,e){e.onEngineEvent(n,i,s,r)}))}},a.prototype._parseEvent=function(i){var s=!0,o=this,a=i[0],h=r.parseString(i[1]),l=i[2];o.objctx.remove("[evt_k.key]"),o.objctx.remove("[evt_k]");var c=a+"."+h;if(0==h.indexOf("sb4_evtx")){if("sb4_evtx_a"==h)c=a+"."+l.src.options._d.type+"."+l.v+"."+h;else if(h==n.EVTX_KEY){var u=SB4API.LEGACY_KEYMAP[l.evt.key];void 0==u&&(u=l.evt.key),c=a+"."+l.op+"."+u+"."+h,o.objctx.add("[evt_k.key]",u),o.objctx.add("[evt_k]",l.evt)}var d=this.dynamicEventMap[c];if(h==n.EVTX_KEY&&(d=e.union(d,this.dynamicEventMap[a+"."+l.op+".[any]."+h])),d&&d.length>0){var p=!1;if(l&&l.remove&&(p=l.remove())){var f=[];t.each(o.eventQueue,function(t,e){var i=e[0],s=r.parseString(e[1]),n=i+"."+s;"sb4_evtx_a"==h&&(n=i+"."+e[2].src.options._d.type+"."+e[2].v+"."+s),c==n&&f.push(e)}),t.each(f,function(t,i){o.eventQueue=e.without(o.eventQueue,i)})}var g={};t.each(d,function(r,n){var a={},c=t.Deferred(),u=c;t.each(t(n.condition).children(),function(e,i){"value"==t(i).prop("tagName")?u=u.then(function(){o.parse.setDisableStopPoint(!0);var e=t.Deferred();return next1=o.parse.parseBlock(t(i).find("block:first"),e),next2=next1.then(function(e){o.parse.setDisableStopPoint(!1),a[t(i).attr("name")]=e}),e.resolve(),next2}):"field"==t(i).prop("tagName")?u=u.then(function(){a[t(i).attr("name")]=t(i).html()}):"mutation"==t(i).prop("tagName")&&(u=u.then("sb4_evtx_path"==h?function(){a.src=o.objctx.get(t(i).attr("pid"))}:function(){t(i).attr("name")&&(a[t(i).attr("name")]=t(i).attr(t(i).attr("name")))}))}),u=u.then(function(){o.logger._info("sb4_evtx result ",a);var r=e.keys(a);if(r.length>0){var h=!0;if(t.each(r,function(i,s){e.isArray(l[s+"_list"])&&e.isArray(a[s])?t.each(l[s+"_list"],function(t,i){e.contains(a[s],i)||(h=!1)}):"[any]"==l[s]||e.isEqual(a[s],l[s])||(h=!1)}),h){var c=n.whenBlockId;e.has(g,c)||(l&&l.src?o.objctx.add("[source]",l.src):o.objctx.get(i[0])?o.objctx.add("[source]",o.objctx.get(i[0])):o.objctx.add("[source]",null),l&&o.objctx.add("[evtval]",l["[evtval]"]),s=!1,o._recordEvent(i),o.statementQueue.push(n.expr),e.str.isBlank(c)||(g[c]=1))}}}),c.resolve()})}else{var v=l.WGT;v&&("sb4_evtx_a"==h&&(c=l.v+"."+h),this.objctx.get(v.options._i,!0)&&v.addIgnoreEvent(c))}}else{var m=this.eventMap[c];if(("key_d"==a||"key_u"==a)&&(m=e.union(m,this.eventMap[a+".[any]"]),o.objctx.add("[evt_k.key]",h),o.objctx.add("[evt_k]",l)),void 0!=m&&m.length>0)t.each(m,function(s,n){var a=!1;if(l&&l.remove&&(a=l.remove())){var h=[];t.each(o.eventQueue,function(t,e){var i=e[0],s=r.parseString(e[1]),n=i+"."+s;c==n&&h.push(e)}),t.each(h,function(t,i){o.eventQueue=e.without(o.eventQueue,i)})}o._recordEvent(i),o.statementQueue.push(n)}),s=!1;else{var v=this.objctx.get(a,!0);v&&v.addIgnoreEvent(h)}l&&l.src?o.objctx.add("[source]",l.src):o.objctx.get(i[0])?o.objctx.add("[source]",o.objctx.get(i[0])):o.objctx.add("[source]",null),l&&o.objctx.add("[evtval]",l["[evtval]"])}if(s)if(this.eventQueue.length>0&&this.eventIdleCount<this.maxEventIdleCount){this.eventIdleCount++;var i=this.eventQueue.shift();this._parseEvent(i)}else this.eventIdleCount=0;else this.eventIdleCount=0},a.prototype.parseXml=function(t){this.status!=a.STATUS_DEAD&&this.parse.parse(t)},a.prototype.addFunctionTask=function(e,i,r,n){var a=t.Deferred(),h=a.then(function(){return s.invoke(e,i,r)}),l=this.parse.createStopPoint(h),c=new o(a,l,n);this.taskQueue.push(c)},a.prototype._processStatement=function(i){if(this.logger._debug(" _processStatement ",i),e.isFunction(i)){var s=t.Deferred(),r=s.then(function(){return i()}),a=this.parse.createStopPoint(r),h=new o(s,a,"statement function");this.taskQueue.push(h)}else{var l=new n(this);this.parse=l;var c=this,s=t.Deferred(),u=s.then(function(){c.objctx=c.objctx.fork(),c.objctx.add(SB4API._OBJECT_KEY.CURRENT_CONTEXT,c.objctx)});try{var r=this.parse.parseBlock(i.find("block:first"),u);r=this.parse.createStopPoint(r);var h=new o(s,r,i.id);r.fail(function(){c.logger._info("fail task and change status to idle")}).always(function(){l&&null!=l.engine&&(l.engine.objctx=l.engine.initObjctx)}),this.taskQueue.push(h)}catch(d){throw d}}},a.prototype.forkWaitEngine=function(i){var s=this.addSubEngine(e.uniqueId(this.id+"_"),i);return s.isFork=!0,s.isWait=!0,t.each(this.listenerQueue,function(t,e){s.addEngineEventListener(e)}),s.objctx=s.objctx.pop(),s.initObjctx=s.objctx,this.objctx=this.initObjctx,s},a.prototype.fork=function(i){var s=this.addSubEngine(e.uniqueId(this.id+"_"),i);for(s.isFork=!0,t.each(this.listenerQueue,function(t,e){s.addEngineEventListener(e)});this.taskQueue.length()>0;)s.taskQueue.push(this.taskQueue.shift());return s.parse=this.parse,this.parse.engine=s,this.addDestroySubEngineTask(s),this.objctx=this.initObjctx,this.status=a.STATUS_IDLE,s},a.prototype.addDestroySubEngineTask=function(t){var e=this,i=function(){t.isSubEnginesInState(a.STATUS_DEAD)?(t.parse.engine=e,t.destroy(),e._purgeSubEngine()):(t.statementQueue.push(i),t.status=a.STATUS_IDLE)};t.statementQueue.push(i)},a.prototype.interrupt=function(t){a.MODE_GOTO_PAGE==t&&(this.taskQueue.shift(),this.status=a.STATUS_IDLE)},a.prototype.getWgtByID=function(t){return this.objctx.get(t)},a.prototype.invokeWidgetMethod=function(t,e,i){return s.invokeWgtMethod(t,e,i)},a.prototype._recordEvent=function(t){e.size(this.lastParsedEventQueue)>=10&&this.lastParsedEventQueue.pop();var i=t[2],s;s=i&&i.src?i.src:this.objctx.get(t[0])?this.objctx.get(t[0]):t[0],e.isObject(s)&&(s=s.options._n);var r={};r.obj=s,r.name=t[1],this.lastParsedEventQueue.push(r)},a.prototype.addStopPoint=function(t){this.stopPoints.push(t)},a.prototype._recordBlockResult=function(t,i){i=r.stringify(i),e.size(this.lastBlockResultQueue)>=10&&this.lastBlockResultQueue.pop();var s={};s[t]=i,this.lastBlockResultQueue.push(s)},h.prototype.shift=function(){return this.queue.shift()},h.prototype.push=function(t){this.queue.push(t)},h.prototype.unshift=function(t){this.queue.unshift(t)},h.prototype.first=function(){return e.first(this.queue)},h.prototype.length=function(){return this.queue.length},l.prototype._process=function(){return s.invoke(this.c,this.method,this.arguments)},a}),define("sb4core/textlib",[],function(){function t(t,e,i,s){this.glyphReg=t,this.textReg=e,this.ctx=i.getContext("2d"),this.dscratchpad=s}window.DEBUG,"undefined"==typeof escapeHtmlEntities&&(escapeHtmlEntities=function(t){return t.replace(/[\u00A0-\uffff<>\&]/g,function(t){return"&"+(escapeHtmlEntities.entityTable[t.charCodeAt(0)]||"#"+t.charCodeAt(0))+";"})},escapeHtmlEntities.entityTable={34:"quot",38:"amp",39:"apos",60:"lt",62:"gt",160:"nbsp",161:"iexcl",162:"cent",163:"pound",164:"curren",165:"yen",166:"brvbar",167:"sect",168:"uml",169:"copy",170:"ordf",171:"laquo",172:"not",173:"shy",174:"reg",175:"macr",176:"deg",177:"plusmn",178:"sup2",179:"sup3",180:"acute",181:"micro",182:"para",183:"middot",184:"cedil",185:"sup1",186:"ordm",187:"raquo",188:"frac14",189:"frac12",190:"frac34",191:"iquest",192:"Agrave",193:"Aacute",194:"Acirc",195:"Atilde",196:"Auml",197:"Aring",198:"AElig",199:"Ccedil",200:"Egrave",201:"Eacute",202:"Ecirc",203:"Euml",204:"Igrave",205:"Iacute",206:"Icirc",207:"Iuml",208:"ETH",209:"Ntilde",210:"Ograve",211:"Oacute",212:"Ocirc",213:"Otilde",214:"Ouml",215:"times",216:"Oslash",217:"Ugrave",218:"Uacute",219:"Ucirc",220:"Uuml",221:"Yacute",222:"THORN",223:"szlig",224:"agrave",225:"aacute",226:"acirc",227:"atilde",228:"auml",229:"aring",230:"aelig",231:"ccedil",232:"egrave",233:"eacute",234:"ecirc",235:"euml",236:"igrave",237:"iacute",238:"icirc",239:"iuml",240:"eth",241:"ntilde",242:"ograve",243:"oacute",244:"ocirc",245:"otilde",246:"ouml",247:"divide",248:"oslash",249:"ugrave",250:"uacute",251:"ucirc",252:"uuml",253:"yacute",254:"thorn",255:"yuml",402:"fnof",913:"Alpha",914:"Beta",915:"Gamma",916:"Delta",917:"Epsilon",918:"Zeta",919:"Eta",920:"Theta",921:"Iota",922:"Kappa",923:"Lambda",924:"Mu",925:"Nu",926:"Xi",927:"Omicron",928:"Pi",929:"Rho",931:"Sigma",932:"Tau",933:"Upsilon",934:"Phi",935:"Chi",936:"Psi",937:"Omega",945:"alpha",946:"beta",947:"gamma",948:"delta",949:"epsilon",950:"zeta",951:"eta",952:"theta",953:"iota",954:"kappa",955:"lambda",956:"mu",957:"nu",958:"xi",959:"omicron",960:"pi",961:"rho",962:"sigmaf",963:"sigma",964:"tau",965:"upsilon",966:"phi",967:"chi",968:"psi",969:"omega",977:"thetasym",978:"upsih",982:"piv",8226:"bull",8230:"hellip",8242:"prime",8243:"Prime",8254:"oline",8260:"frasl",8472:"weierp",8465:"image",8476:"real",8482:"trade",8501:"alefsym",8592:"larr",8593:"uarr",8594:"rarr",8595:"darr",8596:"harr",8629:"crarr",8656:"lArr",8657:"uArr",8658:"rArr",8659:"dArr",8660:"hArr",8704:"forall",8706:"part",8707:"exist",8709:"empty",8711:"nabla",8712:"isin",8713:"notin",8715:"ni",8719:"prod",8721:"sum",8722:"minus",8727:"lowast",8730:"radic",8733:"prop",8734:"infin",8736:"ang",8743:"and",8744:"or",8745:"cap",8746:"cup",8747:"int",8756:"there4",8764:"sim",8773:"cong",8776:"asymp",8800:"ne",8801:"equiv",8804:"le",8805:"ge",8834:"sub",8835:"sup",8836:"nsub",8838:"sube",8839:"supe",8853:"oplus",8855:"otimes",8869:"perp",8901:"sdot",8968:"lceil",8969:"rceil",8970:"lfloor",8971:"rfloor",9001:"lang",9002:"rang",9674:"loz",9824:"spades",9827:"clubs",9829:"hearts",9830:"diams",338:"OElig",339:"oelig",352:"Scaron",353:"scaron",376:"Yuml",710:"circ",732:"tilde",8194:"ensp",8195:"emsp",8201:"thinsp",8204:"zwnj",8205:"zwj",8206:"lrm",8207:"rlm",8211:"ndash",8212:"mdash",8216:"lsquo",8217:"rsquo",8218:"sbquo",8220:"ldquo",8221:"rdquo",8222:"bdquo",8224:"dagger",8225:"Dagger",8240:"permil",8249:"lsaquo",8250:"rsaquo",8364:"euro"}),CanvasRenderingContext2D.prototype.clear=CanvasRenderingContext2D.prototype.clear||function(t){t&&(this.save(),this.setTransform(1,0,0,1,0,0)),this.clearRect(0,0,this.canvas.width,this.canvas.height),t&&this.restore()},t.prototype._applyFontformat=function(t,e,i){if(null!=e){if(void 0!=e["class"]&&t.addClass(e["class"]),void 0!=e.fontSize){var s=parseInt(e.fontSize*i);t.css("font-size",s+"px")}void 0!=e.fontFamily&&(_.str.contains(e.fontFamily,'"')||_.str.contains(e.fontFamily,",")?t.css("font-family",e.fontFamily+", Roboto, Arial , sans-serif"):t.css("font-family",'"'+e.fontFamily+'", Roboto, Arial , sans-serif')),void 0!=e.fontWeight&&t.css("font-weight",e.fontWeight),void 0!=e.fontStyle&&t.css("font-style",e.fontStyle)}},t.prototype.stringToHtml=function(t){for(var e=[],i=t.split(/\n/),s=jQuery(document.createElement("div")),r=0;r<i.length;r++)e.push(i[r]);return e.join("<br>")},t.prototype.drawDivText=function(t,e,i,s,r,n,o,a,h,l,c){var u=s,d=r;d=d.replace(new RegExp("\r\n","g"),"\n"),d=d.replace(new RegExp("\r","g"),"\n"),d=escapeHtmlEntities(d),d=d.replace(new RegExp("  ","g")," &nbsp;"),r=d,r=this.stringToHtml(r),s=$(this.dscratchpad),s.css({}),s.css({visibility:"hidden",position:"absolute",height:"auto",width:"auto"}),void 0!=l&&l>0&&(s.css("display","block"),s.css("width",l)),this._applyFontformat(s,o,n),null!=h&&s.css("color",h),1==a?s.css("text-align","center"):2==a?s.css("text-align","right"):s.css("text-align","left");
var p=[];$(this.dscratchpad).css("word-wrap","break-word"),$(this.dscratchpad).html(r);var f=$(this.dscratchpad).get(0).getBoundingClientRect();return p[0]=Math.ceil(f.width),p[1]=Math.ceil(f.height),$(this.dscratchpad).empty(),$(this.dscratchpad).css("word-wrap","normal"),s=$(u),s.css("word-wrap","break-word"),this._applyFontformat(s,o,n),null!=h&&s.css("color",h),1==a?s.css("text-align","center"):2==a?s.css("text-align","right"):s.css("text-align","left"),l>=0&&(s.width(p[0]),s.height(p[1])),s.html(r),null!=c&&""!=c&&(s.off("click"),s.click(function(){SB4API.linkLib.handleLinkData(t,c)})),p.push(!1),c&&(s.removeClass("notouch"),s.addClass("cursor_pointer")),p},t.prototype.drawDivRichText=function(t,e,i,s,r,n,o,a,h,l){s=$(s),o&&this._applyFontformat(s,o,n),s.html(r),$("a",s).length>0&&(s.removeClass("notouch"),$("a",s).each(function(){var e=$(this).attr("href");if(_.string.startsWith(e,"evt://"))$(this).removeAttr("onclick"),$(this).click(function(e){e.preventDefault();var i=$(this).attr("href");if(i){var s=i.split("::");if(void 0!=s[2]&&""!=s[2]){var r=s[2].split(",");void 0==s[0]&&(s[0]=""),void 0==s[1]&&(s[1]=""),s[1]=_.string.trim(r[0]," '");var n=r.splice(1);s[2]=_.string.trim(n.join()," '")}SB4API.linkLib.openHyperLink(t,s[0],s[1],s[2])}});else{var i=$(this).attr("onclick"),s=void 0,r=$(this).attr("target");if(_.str.startsWith(i,"window.open(this.href")){var n=i.split(",",3);if(null!=n&&3==n.length){r=n[1],r=_.string.trim(r," '");var o=i.substring(n[0].length+n[1].length+2),a=o.lastIndexOf("'");s=o.substring(0,a),s=_.string.trim(s," '")}}$(this).removeAttr("onclick"),$(this).click(function(e){e.preventDefault();var i=$(this).attr("href");SB4API.linkLib.openHyperLink(t,i,r,s)})}})),s.css("width",l)},t.prototype.drawText=function(t,e,i,s,r,n,o,a,h,l,c,u,d){if((void 0==r||""==r)&&(a=!1,r=""),$(s).addClass("notouch"),void 0==a||1==a){var p=e+"."+i;this.ctx.clear();var f=void 0;if(this.textReg&&(f=this.getTextRegData(p)),f&&0!=_.size(f.chars)){var g=this.feelText(f,n);this.ctx.canvas.width=g[0],this.ctx.canvas.height=g[1];var v=this.drawTextByCode(p,n,c,d),m=$("canvas:first-child",s);0==m.length?(m=document.createElement("canvas"),$(s).append(m)):m=m[0],m.id=e+"."+i,m.width=g[0],m.height=g[1],$(m).addClass("notouch"),m.height<10&&$(m).addClass("text");var b=m.getContext("2d");b.drawImage(this.ctx.canvas,0,0);var x=this.glyphReg.linkData;if(_.isEmpty(x)&&null!=d&&(x=d),!_.isEmpty(x)&&v.length>0){$(s).removeClass("notouch"),$(m).removeClass("notouch");var y=null;null!=d?($(s).addClass("cursor_pointer"),y=function(e){if((1==e.which||"mousemove"==e.type)&&"mousemove"!=e.type){var i=_.find(v,function(t){return e.offsetX>=t[0]&&e.offsetX<=t[2]&&e.offsetY>=t[1]&&e.offsetY<=t[3]});void 0!=i&&SB4API.linkLib.handleLinkData(t,d)}}):y=function(e){if(1==e.which||"mousemove"==e.type){var i=_.find(v,function(t){return e.offsetX>=t[0]&&e.offsetX<=t[2]&&e.offsetY>=t[1]&&e.offsetY<=t[3]});if(void 0==i)return void $(s).removeClass("cursor_pointer");if("mousemove"==e.type)return void $(s).addClass("cursor_pointer");var r=x[i[4]];if(void 0!=r){var n=r.split("::");if(void 0!=n[2]&&""!=n[2]){var o=n[2].split(",");void 0==n[0]&&(n[0]=""),void 0==n[1]&&(n[1]=""),n[1]=_.string.trim(o[0]," '");var a=o.splice(1);n[2]=_.string.trim(a.join()," '")}SB4API.linkLib.openHyperLink(t,n[0],n[1],n[2])}}},m.addEventListener("click",y,!1),m.addEventListener("mousemove",y,!1)}return g}return o?this.drawDivRichText(t,e,i,s,r,n,h,l,c,u):this.drawDivText(t,e,i,s,r,n,h,l,c,u,d)}return o?this.drawDivRichText(t,e,i,s,r,n,h,l,c,u):this.drawDivText(t,e,i,s,r,n,h,l,c,u,d)},t.prototype.thinStroke=function(t){return t;var e=Math.floor(t);return e===t&&(e=t+.5),e},t.prototype.drawGlyph=function(t,e,i,s,r,n){for(var o=this.getGlyphData(t),a=o.length,h=0,l=0;a>l;l++){switch(t=o[l],t.o){case 1:var c=r*t.d[0]+i,u=n*t.d[1]+s;c=this.thinStroke(c),u=this.thinStroke(u),e.moveTo(c,u);break;case 2:var c=r*t.d[0]+i,u=n*t.d[1]+s;c=this.thinStroke(c),u=this.thinStroke(u),e.lineTo(c,u);break;case 3:var d=r*t.d[0]+i,p=n*t.d[1]+s,f=r*t.d[2]+i,g=n*t.d[3]+s,v=r*t.d[4]+i,m=n*t.d[5]+s;e.bezierCurveTo(d,p,f,g,v,m),h=Math.max(h,n*t.d[5]+s);break;case 4:e.closePath()}t.o>0&&4!=t.o&&null==t.d,t.o>0&&null!=t.d&&(h=Math.max(h,n*t.d[1]+s))}return h},t.prototype.getGlyphData=function(t){var e=this.glyphReg.data[t];if(void 0==e&&(e=[]),e instanceof Array)return e;for(var i=e.split(","),s=[],r=0;r<i.length;r++){var n=i[r],o={};o.o=n.length%6==0?2:parseInt(n.substring(0,1),10),o.d=[];var a;if(a=n.length%6==0?n:n.substring(1),a.length>0)for(var h=a.length/6,l=0;h>l;l++){var c=a.substring(6*l,6*(l+1)),u=(this.revertDate(this.clearChars(c.substring(0,3)))/10).toString(),d=(this.revertDate(this.clearChars(c.substring(3,6)))/10).toString();o.d.push(u,d)}s.push(o)}return this.glyphReg.data[t]=s,this.glyphReg.data[t]},t.prototype.revertDate=function(t){if(t.length>1){var e,i=parseInt(t,36),s=parseInt(t.charAt(0),36);if(0==s)e=parseInt(t.substring(1),36);else{var r=this.isPositive(i);e=-1==r.positive?-1*(Math.pow(36,r.digit)-i):i}return e}var e=parseInt(t,36);return e>18&&(e=-1*(36-e)),e},t.prototype.isPositive=function(t){var e={},i=0,s=0,r=18*Math.pow(36,i),n=Math.pow(36,i+1);do t>=s&&r>=t?e.positive=1:t>r&&n>t&&(e.positive=-1),i++,s=Math.pow(36,i),r=18*Math.pow(36,i)-1,n=Math.pow(36,i+1);while(t>=s);return 0==e.positive,e.digit=i,e},t.prototype.clearChars=function(t){for(;t.length>1&&"#"==t.charAt(0);)t=t.substring(1);return t},t.prototype.getTextRegData=function(t){var e=this.textReg[t];if(void 0==e)return void 0;if(null!=e.refid&&(t="@"+e.refid,e=this.textReg[t],void 0==e))return void 0;if("object"==typeof e&&e.chars instanceof Array)return e;var i={},s=[],r;r=_.str.isBlank(e.chars)?[]:e.chars.split(",");for(var n=-1,o=-1,a=-1,h=0;h<r.length;h++){var l={},c=r[h],u=c.split("|"),d={};4==u[0].length?(l.mode=0,d.width=parseInt(u[0].substring(0,2),36),d.height=parseInt(u[0].substring(2,4),36)):(l.mode=parseInt(u[0].charAt(0)),d.width=parseInt(u[0].substring(1,3),36),d.height=parseInt(u[0].substring(3,5),36)),l.size=d;var p={};p.x=this.revertDate(u[1]),p.y=this.revertDate(u[2]),l.pos=p,"0"==u[3]?a=-1:""==u[3]?-1!=a&&(l.link=a):(a=u[3],l.link=a),""==u[4]?l.color=n:(n=u[4],l.color=n),l.vectorCode=u[5],7==u.length&&(""==u[6]?l.bgcolor=o:(o=u[6],l.bgcolor=o)),s.push(l)}return i.chars=s,i.size=e.size,this.textReg[t]=i,this.textReg[t]},t.prototype.drawTextByCode=function(t,e,i,s){null==e&&(e=1);var r=void 0,n=[],o=this.getTextRegData(t);if(o){for(var t=0;t<o.chars.length;t++){var a=o.chars[t],h=a.vectorCode,l=this.getGlyphData(h),c=null;if(l.length>0&&0==l[0].o&&(c=l[0].d),void 0!=i?r=i.toString():void 0!=a.color&&(r=this.glyphReg.colorData[a.color],r=this.hex2RGBA(r)),null!=c){if(this.ctx.beginPath(),a.bgcolor){var u=this.glyphReg.colorData[a.bgcolor];u=this.hex2RGBA(u),this.ctx.fillStyle=u,this.ctx.fillRect(a.pos.x,a.pos.y,a.size.width,a.size.height)}this.ctx.beginPath(),this.ctx.fillStyle=r;var d=a.size.width/c[0],p=a.size.height/c[1];this.drawGlyph(h,this.ctx,a.pos.x*e,a.pos.y*e,d*e,p*e),this.ctx.fill()}if(void 0!=a.mode)switch(a.mode){case 1:this.ctx.beginPath(),this.ctx.arc(a.pos.x,a.pos.y,a.size.width/2,0,2*Math.PI,!0),this.ctx.fillStyle=r,this.ctx.fill(),this.ctx.closePath();break;case 2:break;case 4:break;case 9:this.ctx.beginPath(),this.ctx.moveTo(a.pos.x,a.pos.y),this.ctx.lineTo(a.pos.x+a.size.width,a.pos.y),this.ctx.stroke(),this.ctx.closePath()}void 0!=s&&""!=s?n.push([a.pos.x,a.pos.y,a.pos.x+a.size.width,a.pos.y+a.size.height,s]):void 0!=a.link&&n.push([a.pos.x,a.pos.y,a.pos.x+a.size.width,a.pos.y+a.size.height,a.link])}return n}},t.prototype.feelText=function(t,e){void 0==e&&(e=1);var i=[0,0],s=!0;t.size&&(i[0]=t.size.width,t.size.width>=0&&(s=!1));for(var r=0;r<t.chars.length;r++){var n=t.chars[r],o=n.vectorCode,a=this.getGlyphData(o);if(0!=a.length){var h=null;if(0==a[0].o&&(h=a[0].d),null!=h){var l=n.pos.x+n.size.width,c=n.pos.y+n.size.height;s&&l>i[0]&&(i[0]=l),c>i[1]&&(i[1]=c)}}}return i[0]=i[0]*e,i[1]=i[1]*e,i},t.prototype.hex2RGBA=function(t){if(void 0==t)return"rgba(0, 0, 0, 0)";var e="rgba(0, 0, 0, 0)";if(6==t.length)e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),e={r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16),a:255};else{if(8!=t.length)return e;e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(t),e={r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16),a:parseInt(e[4],16)}}return"rgba("+e.r+","+e.g+","+e.b+","+e.a/255+")"};var e=document.createElement("div");e.id="textLibDiv",$(e).css("display","none");var i=document.createElement("canvas");i.id="textLibCanvas",i.width=2e3,i.height=2e3,i.style="border:0px solid #ffffff;",e.appendChild(i),document.body.appendChild(e);var s=document.createElement("div");s.id="divTextDiv",$(s).css({visibility:"hidden",position:"absolute",height:"auto",width:"auto"}),document.body.appendChild(s);var r=document.getElementById("textLibCanvas"),n=new t({},{},r,s);return n}),define("sb4core/SB4Debug",["sb4core/DataUtil"],function(t){function e(t){this.loEngine=t,this.breakPoint=!1,this.objctx=null}return e.prototype.getDebugInfo=function(){loEngine=_.clone(this.loEngine);var e=loEngine.subEngines[0],i=_.clone(e.objctx.get("_frame")),s=i.scene,r={};r.engine=this.getDebugEngine(i.sceneLocalEngine),r.folders=this.getSlideSets(i,e);var n={};return n["Page:["+s.name+"]"]=r,n["Global Variables"]=this.getGlobalVars(e),n["Local Variables"]=this.getLocalVars(this.objctx),n.Maps=SB4API.rootContext.getObjMap(),t.stringifyStageJsonModel(n)},e.prototype.getDebugEngine=function(t){var e={};return e.id=t.id,e.status=t.status,e.lastParsedEvents=t.lastParsedEventQueue,e.lastBlockResults=t.lastBlockResultQueue,e},e.prototype.getGlobalVars=function(t){var e={},i="global ",s=t.objctx.map,r=_.keys(t.objctx.map);return _.each(r,function(t,r){if(0==t.indexOf(i)){var n=s[t];e[t]="boolean"==typeof n?1==n?!0:!1:0==isNaN(n)?n:s[t]?s[t]:"[undefined]"}}),e},e.prototype.getLocalVars=function(t){var e={},i=this;return null==t||_.has(t.map,"[ctx_type]")||(void 0!=t.extctx&&(e=_.extend(this.getLocalVars(t.extctx),e)),e=_.extend(e,t.map)),e},e.prototype.getSlideSets=function(e,i){var s=this,r=[],n=e.scene,o=_.indexBy(n.layers,"id"),a=e.mastermap;return _.each(n.slides,function(n,h){var l=t.trimRefString(n.$ref),c,u;o[l]?(u=o[l],c="L: "+u.name,u=s.parseSlideSet(o[l],e.sceneLocalEngine)):(u=a[l],c="M: "+u.name,u=s.parseSlideSet(a[l],i.getSubEngineByID(l)),u.engine=s.getDebugEngine(i.getSubEngineByID(l)));var d={};d[c]=u,r.push(d)}),r},e.prototype.parseSlideSet=function(e,i){var s=t.stringifyStageJsonModel(e);return e=JSON.parse(s),_.has(e,"slides")&&(e.layers=_.map(e.slides,function(t){var e={},s;return _.has(t,"widgets")&&(t.widgets=_.map(t.widgets,function(t){null==i.objctx.get(t.id)&&(t["._error"]=!0);var e={};return e[t.name]=_.pick(t,"id","type","._error"),e})),e[t.name]=_.pick(t,"widgets"),e})),_.pick(e,"layers")},e.prototype.onBreakPoint=function(e,i){this.onBreakPointExt&&(this.breakPoint=!0,this.objctx=i,this.loEngine.stop(!1),e.info=this.getDebugInfo(),this.onBreakPointExt(t.stringifyStageJsonModel(e)))},e.prototype.start=function(){this.breakPoint=!1,this.objctx=null,this.loEngine.start()},e}),define("sb4core/loplayer",["underscore","./sbobjfactory","sb4core/loloader","sb4core/ObjContext","sb4core/SB4Engine","sb4core/textlib","sb4core/SB4Debug"],function(t,e,i,s,r,n,o){SB4API.stageLog("loplayer init");var a={factory:null,play:function(){function a(t){if(t.changedTouches.length>0){var e=t.changedTouches[0],i=$(N).position();SB4API.rootContext.add("[stageXY]",[Math.round(e.pageX-i.left),Math.round(e.pageY-i.top)])}}SB4API.stageLog("loplayer play start");var h=t.find(i.lo.meta.entries,function(t){return"id"==t.id}),l="";null!=h&&(l=h.value),SB4API.tabOrder=t.find(i.lo.meta.entries,function(t){return"tabOrder"==t.id}).value,SB4API.mediaAutoPlayAuthorization=t.find(i.lo.meta.entries,function(t){return"mediaAutoPlay"==t.id}).value,SB4API.disableEngineAddEvent=!1;var c=t.find(i.lo.meta.entries,function(t){return"scaling"==t.id}).value;SB4API.getOrientation=function(){var t=window.orientation;if("number"==typeof t&&"object"==typeof window.onorientationchange)switch(t){case 90:case-90:t="landscape";break;default:t="portrait"}else t=window.innerWidth>window.innerHeight?"landscape":"portrait";return t},SB4API.isMobile={Android:function(){return navigator.userAgent.match(/Android/i)},AndroidNonTablet:function(){return SB4API.isMobile.Android()&&navigator.userAgent.match(/Mobile/i)&&!navigator.userAgent.match(/Kindle/i)},BlackBerry:function(){return navigator.userAgent.match(/BlackBerry/i)},iOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i)},iPhone:function(){return navigator.userAgent.match(/iPhone/i)},iOSNonTablet:function(){return navigator.userAgent.match(/iPhone|iPod/i)},Opera:function(){return navigator.userAgent.match(/Opera Mini/i)},Windows:function(){return navigator.userAgent.match(/IEMobile/i)},any:function(){return SB4API.isMobile.Android()||SB4API.isMobile.BlackBerry()||SB4API.isMobile.iOS()||SB4API.isMobile.Opera()||SB4API.isMobile.Windows()},anyPhone:function(){return SB4API.isMobile.AndroidNonTablet()||SB4API.isMobile.BlackBerry()||SB4API.isMobile.iOSNonTablet()||SB4API.isMobile.Opera()||SB4API.isMobile.Windows()}};var u=t.find(i.lo.meta.entries,function(t){return"profile"==t.id}),d=t.map(u.subs,function(e){var i=JSON.parse(e.value);return i.id=e.id,i.hMap=t.omit(i.hMap,function(t,e,i){return 0==t}),i});if(SB4API.profile={},SB4API.updateScale=function(e){if(SB4API.isMobile.any()){var s=document.querySelector('meta[name="viewport"]'),r,n,o;o=null!=SB4API.currentScene?SB4API.currentScene.id:SB4API.initSceneId?SB4API.initSceneId:i.lo.frame.flow.subflow.id;var a=e.h;t.has(e.hMap,o)&&(a=e.hMap[o]),"landscape"==SB4API.getOrientation()?(r=Math.max(screen.height,screen.width)/e.w,n=Math.min(screen.height,screen.width)/a):(r=screen.width/e.w,n=screen.height/a);var h;h=0==c?r:Math.min(r,n),s.setAttribute("content","width="+e.w+", initial-scale="+h+",maximum-scale="+h+", minimum-scale="+h+" ,user-scalable=no")}},SB4API.profile.selectProfile=function(){var e,i,s;if(t.isArray(SB4API.currentViewport))i=SB4API.currentViewport[0],s=SB4API.currentViewport[1];else{var r=document.documentElement.getBoundingClientRect();i=r.width,s=r.height}if(SB4API.isMobile.any()){var n=[],o=[],a=[],h=[],l=[],c;t.each(SB4API.profile.list,function(t,e){"PHONE"==t.t?t.w>t.h?n.push(t):a.push(t):"TABLET"==t.t?t.w>t.h?o.push(t):h.push(t):l.push(t)}),c="landscape"==SB4API.getOrientation()?SB4API.isMobile.anyPhone()&&n.length>0?n:o.length>0?o:l:SB4API.isMobile.anyPhone()&&a.length>0?a:h.length>0?h:l;var u=t.filter(c,function(t){return t.w<=i}),d=0;t.each(u,function(t,e){t.w>d&&(d=t.w)}),u=t.filter(u,function(t){return t.w==d}),0==u.length?e=c[0]:1==u.length?e=u[0]:u.length>1&&(u=t.sortBy(u,function(t){return t.h}),e=t.find(u.reverse(),function(t){return t.h<s}),null==e&&(e=t.last(u)))}else{var l=[],p=[];t.each(SB4API.profile.list,function(t,e){"PC"==t.t?l.push(t):p.push(t)});var u=t.filter(l,function(t){return t.w<=i});0==u.length&&(u=t.filter(p,function(t){return t.w<=i}));var d=0;t.each(u,function(t,e){t.w>d&&(d=t.w)}),u=t.filter(u,function(t){return t.w==d}),0==u.length?e=SB4API.profile.list[0]:1==u.length?e=u[0]:u.length>1&&(u=t.sortBy(u,function(t){return t.h}),e=t.find(u.reverse(),function(t){return t.h<s}),null==e&&(e=t.last(u)))}return e},SB4API.profile.list=t.sortBy(d,function(t){return t.w}),SB4API.fixProfile)SB4API.profile.current=SB4API.fixProfile;else if("function"==typeof GetInitProfileIdFunction){var p=GetInitProfileIdFunction(),f=t.find(SB4API.profile.list,function(t){return t.id==p});f&&(SB4API.profile.current=f)}null==SB4API.profile.current&&(SB4API.profile.current=SB4API.profile.selectProfile());var g=function(e,i){if(e){t.has(i,e.id)?e.time=i[e.id]:delete e.time;var s=e.flows;t.isArray(s)&&t.each(s,function(t,e){g(t,i)}),g(e.subflow,i)}},v=function(t){var e=t&&"scroll"==t.type;SB4API.alignToBody(e),U._util.floatWidgetsPosition()},m=t.throttle(v,250,{leading:!1});SB4API.updateProfile=function(e){var i=SB4API.profile.current,s;if(s=t.isString(e)?t.find(SB4API.profile.list,function(t){return t.id==e}):SB4API.fixProfile?SB4API.fixProfile:SB4API.profile.selectProfile(),s&&i.id!=s.id){SB4API.disableEngineAddEvent=!0,SB4API.profile.current=s,g(U.options._d.flow,s.hMap),SB4API.showLoading(),U.preloadResourcesBeforeChangeProfile(),U.changeProfile(s),SB4API.hideLoading(),SB4API.disableEngineAddEvent=!1;var r={};r.broadcast=!1,r["[evtval]"]=s.d;for(var n=0;n<U.engine.subEngines.length;n++)U.engine.subEngines[n].addEvent("flow","pchange",r);"function"==typeof OnProfileChangeFunction&&OnProfileChangeFunction(s.id)}else m();if($("#playButton").length>0){var o,a;if(0==SB4API.mediaAutoPlayAuthorization){var h=$(".com_smartbuilder_axon_widget_frame").eq(0);o=document.documentElement.clientWidth>h.width()?parseInt((h.width()-$("#playButton").width())/2)+h.offset().left+"px":parseInt((document.documentElement.clientWidth-$("#playButton").width())/2)+h.scrollLeft()+"px",a=document.documentElement.clientHeight>h.height()?parseInt((h.height()-$("#playButton").height())/2)+h.offset().top+"px":parseInt((document.documentElement.clientHeight-$("#playButton").height())/2)+h.scrollTop()+"px"}else o=parseInt((document.documentElement.clientWidth-$("#playButton").width())/2)+"px",a=parseInt((document.documentElement.clientHeight-$("#playButton").height())/2)+"px";$("#playButton").css("left",o),$("#playButton").css("top",a)}};var b="number"==typeof window.orientation&&"object"==typeof window.onorientationchange;if(b){var _=t.throttle(SB4API.updateProfile,400,{leading:!1});window.addEventListener("orientationchange",_,!1)}else{var _=t.throttle(SB4API.updateProfile,200,{leading:!1});$(window).resize(_)}window.onscroll=m,i.lo.lib&&(assetmap=t.clone(i.lo.lib)),SB4API.txtLib=n,SB4API.txtLib.glyphReg=i.text.glyphReg,SB4API.txtLib.textReg=i.text.textReg;var x=new s;if(SB4API.launchTime=$.now(),SB4API.getDurationValue=function(){if(SB4API.launchTime){var t=$.now()-SB4API.launchTime;return t>0?t/1e3:0}return-1},SB4API.getPageDurationValue=function(){if(SB4API.pageLaunchTime){var t=$.now()-SB4API.pageLaunchTime;return t>0?t/1e3:0}return-1},t.isObject(SB4API.lms)&&SB4API.lms.type>0){var y=$.sb4.com_smartbuilder_axon_widget_data_track();y.lmsEnable=!0,x.add("scorm",y)}if(SB4API.xapi.tincan){var w=$.sb4.com_smartbuilder_axon_widget_data_xapi();w.xapiEnable=!0,x.add("xapi",w),SB4API.xapi.launchLesson()}SB4API.terminateLMS=function(){var t=x.get("scorm");null!=t&&t.terminate()};var S=assetmap.audios,T=assetmap.videos;if(S>0?(SB4API.audioCapable=!1,SB4API.previewEmbed===!0&&SB4API.setAudioCapable()):SB4API.audioCapable=!0,SB4API.previewEmbed!==!0&&(S>0||T>0)){var I=$("<div id='media'></div>");I.hide(),I.appendTo("body");var B=S,A=T;if(B>=32&&(B=32),A>=32&&(A=32),"undefined"!=typeof window.orientation){for(var E=0;B>E;E++){var P=$("<audio  src ='"+SB4API.addBustParam("app/empty.mp3")+"' class='audio-unused'></audio>");P.appendTo("#media")}for(var E=0;A>E;E++){var C=$("<video src ='"+SB4API.addBustParam("app/empty.mp4")+"' class='video-unused'></video>");C.appendTo("#media")}}else{if(S>0){var P=$("<audio  src ='"+SB4API.addBustParam("app/empty.mp3")+"' class='audio-unused'></audio>");P.appendTo("#media")}if(T>0){var C=$("<video src ='"+SB4API.addBustParam("app/empty.mp4")+"' class='video-unused'></video>");C.appendTo("#media")}}2==SB4API.mediaAutoPlayAuthorization?($(document).one("click",function(){$.each($("audio"),function(t,e){e.load()}),SB4API.setAudioCapable(),$.each($("video"),function(t,e){$(e).hasClass("video-unused")?(e.setAttribute("src",""),e.load()):e.load()}),"undefined"!=typeof window.orientation||$("#media").empty()}),$("#playFull").remove()):1==SB4API.mediaAutoPlayAuthorization&&$(document).ready(function(){SB4API.playButtonBackgroundColor&&$("#playFull").css("background-color",SB4API.playButtonBackgroundColor),$("#playFull").show();var t=0;1==SB4API.tabOrder&&(t=1),$("#playFull").html('<div id="playButton" style="width: 150px;height: 150px;position:absolute;"><div class="notouch" style="width: 100%; height: 100%; position: absolute"><button tabindex="'+t+'" class="" style="width: 100%; height: 100%;border: none; background-color: rgba(255,255,255,0);" aria-label="Authorize media to autoplay."></button></div><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"	 width="150px" height="150px" viewBox="0 0 92 92" enable-background="new 0 0 92 92" xml:space="preserve"><g>	<path fill="#6B6B6B" d="M46,8c20.953,0,38,17.047,38,38S66.953,84,46,84C25.047,84,8,66.953,8,46S25.047,8,46,8 M46,1		C21.147,1,1,21.147,1,46c0,24.854,20.147,45,45,45c24.851,0,45-20.146,45-45C91,21.147,70.852,1,46,1L46,1z"/>	<path fill="#6B6B6B" d="M38.167,25.147c-0.368,0-0.736,0.085-1.077,0.257c-0.802,0.406-1.309,1.229-1.309,2.129v37.725		c0,0.899,0.506,1.723,1.309,2.129c0.34,0.172,0.71,0.257,1.077,0.257c0.5,0,0.996-0.156,1.414-0.463l25.667-18.863		c0.611-0.45,0.973-1.164,0.973-1.923c0-0.759-0.361-1.473-0.973-1.923L39.58,25.61C39.163,25.304,38.666,25.147,38.167,25.147		L38.167,25.147z"/></g></svg></div>');var e=parseInt((document.documentElement.clientWidth-$("#playButton").width())/2)+"px",i=parseInt((document.documentElement.clientHeight-$("#playButton").height())/2)+"px";$("#playButton").css("left",e),$("#playButton").css("top",i),$("#playFull").on("click",function(){$.each($("audio"),function(t,e){e.load()}),SB4API.setAudioCapable(),$.each($("video"),function(t,e){e.setAttribute("src",""),e.load()}),"undefined"!=typeof window.orientation||$("#media").empty();var t=R.subEngines[0],e=t.objctx.get("_frame"),i=e.objctx.get("playFull_scene");$("#playFull").remove(),e._renderScene(i),e.objctx.remove("playFull_scene")})})}else $("#playFull").remove();$(document).ready(function(){t.isObject(SB4API.lms)&&SB4API.lms.type>0&&$(window).on("beforeunload",function(){SB4API.showErrorMessage=!1,"closed"!=SB4API.STATUS&&SB4API.terminateLMS()})});var k=t.find(i.lo.meta.entries,function(t){return"bgchoice"==t.id});if(0==k.value){var O=t.find(i.lo.meta.entries,function(t){return"bgcolor"==t.id});if(null!=O.cid)$("body").css("background-color","#"+O.cid);else{var M=null!=O.R?O.R:0,L=null!=O.G?O.G:0,D=null!=O.B?O.B:0;$("body").css("background-color","rgb("+M+","+L+","+D+")")}}else{var V=t.find(i.lo.meta.entries,function(t){return"bgimage"==t.id});$("body").css("background-image","url("+SB4API.util.getWidgetAssetURI(V.key)+")"),$("body").css("background-repeat","repeat")}SB4API.rootContext=x,SB4API.rootContext.add(SB4API._OBJECT_KEY.MOVE_TIME,SB4API._CONF._MOVE_TIME),SB4API.rootContext.add(SB4API._OBJECT_KEY.LAYOUT_TIME,SB4API._CONF._LAYOUT_TIME),SB4API.rootContext.add(SB4API._OBJECT_KEY.EFFECT_TIME,SB4API._CONF._EFFECT_TIME),SB4API.rootContext.add(SB4API._OBJECT_KEY.EXIT_MSG,SB4API._CONF._EXIT_MSG),SB4API.rootContext.add(SB4API._OBJECT_KEY.EXIT_URL,SB4API._CONF._EXIT_URL),SB4API.rootContext.add(SB4API._OBJECT_KEY.XAPI_CONTEXT,SB4API._CONF._XAPI_CONTEXT);var R=new r(l,null,x);if(R.objctx.add("[ctx_type]","lo"),this.factory=new e(R),SB4API.initSceneId){var F={};F.eClass="StrData",F.id="selectedScene",F.value=SB4API.initSceneId,i.lo.frame.data.entries.push(F)}var N=this.factory._createObjDiv($("#playerstage"));$(N).css("visibility","hidden");var j=i.lo.frame;j.bounds.w=SB4API.profile.current.w,j.bounds.h=SB4API.profile.current.h,g(j.flow,SB4API.profile.current.hMap);var W=this.factory.create(N,j,null,"Frame");if(SB4API.isMobile.any()?(N.get(0).addEventListener("touchstart",a,!1),N.get(0).addEventListener("touchmove",a,!1)):$(N).mousemove(function(t){var e=$(N).position();SB4API.rootContext.add("[stageXY]",[t.pageX-e.left,t.pageY-e.top])}),SB4API.alignToBody=function(t){if($("body").width()>=$(N).width()?$(N).css("left",parseInt(($("body").width()-$(N).width())/2)+"px"):($(N).css("left","0px"),t||(document.documentElement.scrollLeft=parseInt(($(N).width()-$("body").width())/2))),$(N).css("top","0px"),$("#playFull").length>0){var e,i,s=$(".com_smartbuilder_axon_widget_frame").eq(0);e=document.documentElement.clientWidth>s.width()?parseInt((s.width()-$("#playButton").width())/2)+s.offset().left+"px":parseInt((document.documentElement.clientWidth-$("#playButton").width())/2)+s.scrollLeft()+"px",i=document.documentElement.clientHeight>s.height()?parseInt((s.height()-$("#playButton").height())/2)+s.offset().top+"px":parseInt((document.documentElement.clientHeight-$("#playButton").height())/2)+s.scrollTop()+"px",$("#playButton").css("left",e),$("#playButton").css("top",i)}},SB4API.alignToBody(),"undefined"==typeof window.orientation){var Q=t.debounce(SB4API.alignToBody,300);$(window).resize(Q)}this.factory._activateObjDiv(N,void 0!=W),$(N).css("visibility","inherit");var U=x.get(W.attr("id")),z=new o(R);SB4API.debug=z,$(document).keydown(function(t){if(SB4API.KEY_DOWN_YES){t.broadcast=!0;var e=SB4API.LEGACY_KEYMAP[t.key];void 0==e&&(e=t.key),U.onEngineEvent(R,"key_d",e,t)}}),$(document).keyup(function(t){if(SB4API.KEY_UP_YES){t.broadcast=!0;var e=SB4API.LEGACY_KEYMAP[t.key];void 0==e&&(e=t.key),U.onEngineEvent(R,"key_u",e,t)}}),$("#lesson_begin").focus(function(){SB4TabOrder.current="begin",0!=t.size(SB4TabOrder.previousOrder)&&0==t.size(SB4TabOrder.nextOrder)&&(SB4TabOrder.nextOrder=SB4TabOrder.previousOrder.slice(0),SB4TabOrder.nextOrder=SB4TabOrder.nextOrder.reverse(),SB4TabOrder.previousOrder=[])}),$("#lesson_end").focus(function(){SB4TabOrder.current="end",0==t.size(SB4TabOrder.previousOrder)&&0!=t.size(SB4TabOrder.nextOrder)&&(SB4TabOrder.previousOrder=SB4TabOrder.nextOrder.slice(0),SB4TabOrder.previousOrder=SB4TabOrder.previousOrder.reverse(),SB4TabOrder.nextOrder=[])});var H=$("#tab_previous"),q=$("#tab_next"),J=function(){if("end"==SB4TabOrder.current)return void H.triggerHandler("focus");if(SB4TabOrder.current="",""!=SB4TabOrder.focusElement){var t=SB4TabOrder.focusElement,e=U._util.getStageObjectInstanceByElement($("#"+t));e&&(e.setAccessibilityHidden(!0),e.setTabIndex(-1)),SB4TabOrder.previousOrder.length>0?SB4TabOrder.previousOrder.splice(0,0,t):SB4TabOrder.previousOrder.push(t)}for(var i=!1;!i;)if(SB4TabOrder.nextOrder.length>0){var s=SB4TabOrder.nextOrder.shift(),r=U._util.getStageObjectInstanceByElement($("#"+s));if(r){var n=r.getScreenReaderTabElement();n&&n.length>0&&(SB4TabOrder.focusElement=s,r.setAccessibilityHidden(!1),i=!0,setTimeout(function(){r.setFocus()},100))}i||(SB4TabOrder.previousOrder.length>0?SB4TabOrder.previousOrder.splice(0,0,s):SB4TabOrder.previousOrder.push(s))}else SB4TabOrder.focusElement="",i=!0,setTimeout(function(){$("#lesson_end").focus()},100);var o=$(this)};q.focus(J);var G=function(){if("begin"==SB4TabOrder.current)return void q.triggerHandler("focus");if(SB4TabOrder.current="",""!=SB4TabOrder.focusElement){var t=SB4TabOrder.focusElement,e=U._util.getStageObjectInstanceByElement($("#"+t));e&&(e.setAccessibilityHidden(!0),e.setTabIndex(-1)),SB4TabOrder.nextOrder.length>0?SB4TabOrder.nextOrder.splice(0,0,t):SB4TabOrder.nextOrder.push(t)}for(var i=!1;!i;)if(SB4TabOrder.previousOrder.length>0){var s=SB4TabOrder.previousOrder.shift(),r=U._util.getStageObjectInstanceByElement($("#"+s));if(r){var n=r.getScreenReaderTabElement();n&&n.length>0&&(SB4TabOrder.focusElement=s,i=!0,r.setAccessibilityHidden(!1),setTimeout(function(){r.setFocus()},100))}i||(SB4TabOrder.nextOrder.length>0?SB4TabOrder.nextOrder.splice(0,0,s):SB4TabOrder.nextOrder.push(s))}else SB4TabOrder.focusElement="",i=!0,setTimeout(function(){$("#lesson_begin").focus()},100);var o=$(this)};H.focus(G)}};return a}),define("sb4core/syscheck",["modernizr"],function(){SB4API.preferXHR=!1;var t=[];if("undefined"!=typeof Modernizr){var e=Modernizr;e.svg||t.push("svg"),e.canvas||t.push("canvas"),e.audio||t.push("audio"),e.video||t.push("video"),t.length>0&&SB4API.handleError("Warning: Your browser does not support the following required HTML5 features: "+t)}return t}),function(t,e){"function"==typeof define&&define.amd?define("lib/FileSaver.min",[],e):"undefined"!=typeof exports?e():(e(),t.FileSaver={exports:{}}.exports)}(this,function(){function t(t,e){return"undefined"==typeof e?e={autoBom:!1}:"object"!=typeof e&&(e={autoBom:!e}),e.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(t.type)?new Blob(["﻿",t],{type:t.type}):t}function e(t,e,i){var s=new XMLHttpRequest;s.open("GET",t),s.responseType="blob",s.onload=function(){o(s.response,e,i)},s.onerror=function(){},s.send()}function i(t){var e=new XMLHttpRequest;e.open("HEAD",t,!1);try{e.send()}catch(t){}return 200<=e.status&&299>=e.status}function s(t){try{t.dispatchEvent(new MouseEvent("click"))}catch(e){var i=document.createEvent("MouseEvents");i.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),t.dispatchEvent(i)}}var r="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof global&&global.global===global?global:void 0,n=/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),o=r.saveAs||("object"!=typeof window||window!==r?function(){}:"download"in HTMLAnchorElement.prototype&&!n?function(t,n,o){var a=r.URL||r.webkitURL,h=document.createElement("a");n=n||t.name||"download",h.download=n,h.rel="noopener","string"==typeof t?(h.href=t,h.origin===location.origin?s(h):i(h.href)?e(t,n,o):s(h,h.target="_blank")):(h.href=a.createObjectURL(t),setTimeout(function(){a.revokeObjectURL(h.href)},4e4),setTimeout(function(){s(h)},0))}:"msSaveOrOpenBlob"in navigator?function(r,n,o){if(n=n||r.name||"download","string"!=typeof r)navigator.msSaveOrOpenBlob(t(r,o),n);else if(i(r))e(r,n,o);else{var a=document.createElement("a");a.href=r,a.target="_blank",setTimeout(function(){s(a)})}}:function(t,i,s,o){if(o=o||open("","_blank"),o&&(o.document.title=o.document.body.innerText="downloading..."),"string"==typeof t)return e(t,i,s);var a="application/octet-stream"===t.type,h=/constructor/i.test(r.HTMLElement)||r.safari,l=/CriOS\/[\d]+/.test(navigator.userAgent);if((l||a&&h||n)&&"undefined"!=typeof FileReader){var c=new FileReader;c.onloadend=function(){var t=c.result;t=l?t:t.replace(/^data:[^;]*;/,"data:attachment/file;"),o?o.location.href=t:location=t,o=null},c.readAsDataURL(t)}else{var u=r.URL||r.webkitURL,d=u.createObjectURL(t);o?o.location=d:location.href=d,o=null,setTimeout(function(){u.revokeObjectURL(d)},4e4)}});r.saveAs=o.saveAs=o,"undefined"!=typeof module&&(module.exports=o)}),define("sb4core/linkhandler",[],function(){var t={generateWindowParam:function(t){var e="";return null==t?e:((null!=t.w||null!=t.h)&&(e="toolbar=no,menubar=no,fullscreen=no,",e=e+"width="+parseInt(t.w)+",",e=e+"height="+parseInt(t.h)+","),e)},openHyperLink:function(t,e,i,s){if(void 0!=e&&""!=e){if(0!=e.indexOf("evt://")){if((null==i||""==i)&&(i="_blank"),SB4API._EMBEDDED)if($.notify("Open external URL("+e+") is not fully supported in authoring preview mode.","warn"),"_self"!=i){var r=SB4WindowHandlerFunction("open",e);if("ok"!=r)return}else if(0!=e.toUpperCase().indexOf("HTTP://")&&0!=e.toUpperCase().indexOf("HTTPS://"))return;var n=null;return n=null!=s&&""!=s?SB4API.openWindow(e,i,s):SB4API.openWindow(e,i)}if(null!=t){var o={},a=e.lastIndexOf(":");a>5&&(o["[evtval]"]=e.substring(a+1),e=e.substring(0,a)),t.fireGlobalEvent(e,o)}}},handleLinkData:function(t,e){if(_.isObject(e)){var i=[];if(i[0]=e.link,_.string.isBlank(i[0]))return;if(null!=e.subs){var s=e.subs[0].t,r=e.subs[1].o;if(!_.string.isBlank(r)){var n=r.split(",");s=_.string.trim(n[0]," '");var o=n.splice(1);r=_.string.trim(o.join()," '")}this.openHyperLink(t,e.link,s,r)}else this.linkLib.openHyperLink(t,e.link,"","")}}};return SB4API.linkLib=t,t}),define("widgets/com.smartbuilder.axon.widget.frame/timeline",["jquery","underscore","sb4core/Logger","sb4core/DataUtil"],function(t,e,i,s){function r(t,e){this.engine=t,this.maxWaitCount=20,this.waitCount=0,this.waitAudioCount=0,this.maxWaitAudioCount=10,this.gotoTimer=-1,this.endTime=0,this.time=0,this.timer=-1,this.points=[],this.tick=50,this.data=e?JSON.parse(e):{},this.ascStartTimeWgts=[],this.ascEndTimeWgts=[],this.nextStartTime=-1,this.nextEndTime=-1,this.lastTickTime=-1,this.activeWgts={},this.logger=new i("timeline",function(){return i.getDefaultPrefix()+" timeline "
}),this.status=this.STATUS_IDLE,this.refAudio=void 0,this._init()}return r.prototype.STATUS_DEAD="dead",r.prototype.STATUS_STOP="stop",r.prototype.STATUS_PROCESS="process",r.prototype.STATUS_IDLE="idle",r.prototype._init=function(){if(this.logger._debug("init ... "),e.isEmpty(this.data))return this.logger._warn("timeline not data"),void this.play("destroy");this.endTime=this.data.endTime,this._createPoints(this.data._qPoint,0);var i=this._parseData(this.data._children);this.data.wgts=i,this.data.wgts.length>0&&(this._parseAscStartTimeWgts(this.data.wgts,0),this._parseAscEndTimeWgts(this.data.wgts,0)),this._modifyNextStartTime(),this._modifyNextEndTime(),t.each(i,function(t,e){e.obj._timelineStop(!1)}),this.logger._debug("init  ok ")},r.prototype._parseData=function(i){var s=[],r=this;return t.each(i,function(i,n){t.each(n.ranges,function(t,i){var o={};o.id=n.id,o.obj=r.getWgtByID(o.id),o.start=i.start,o.end=i.end,o.isAudio="com.smartbuilder.axon.widget.audio"!=o.obj.options._d.type||e.string.isBlank(o.obj.src)?!1:!0,o.isFixToEnd=1==i.isFixToEnd?i.isFixToEnd:o.end==r.endTime?!0:!1,o.obj&&s.push(o)})}),s},r.prototype._createPoints=function(i,s){var r=[];e.isArray(i)&&i.length>0&&(t.each(i,function(t,e){e.time>=s&&r.push(e)}),this.points=e.sortBy(r,function(t){return t.time}))},r.prototype._parseAscStartTimeWgts=function(t,i){var s=e.filter(t,function(t){return t.start>=i});s=e.sortBy(s,function(t){return t.start}),s=e.groupBy(s,function(t){return t.start}),this.ascStartTimeWgts=e.values(s)},r.prototype._parseAscEndTimeWgts=function(t,i){var s=e.filter(t,function(t){return!t.isFixToEnd});s=e.sortBy(s,function(t){return t.start}),s=e.sortBy(s,function(t){return t.end}),s=e.groupBy(s,function(t){return t.end}),this.ascEndTimeWgts=e.values(s)},r.prototype._timelineGoto=function(i){this._timelineStop(!0);var r=s.parseNumber(i);0>r&&(r=0),r=10*r,r=100*Math.floor(r),this.time=r,this._createPoints(this.data._qPoint,r),this.data.wgts.length>0&&(this._parseAscStartTimeWgts(this.data.wgts,r),this._parseAscEndTimeWgts(this.data.wgts,r)),this._modifyNextStartTime(),this._modifyNextEndTime(),this._updateActiveWgts(r);var n=this;n._clearRefAudio(),t.each(e.values(this.activeWgts),function(t,e){return e.isAudio?(n.refAudio=e,!1):void 0});var n=this;clearInterval(this.gotoTimer),this.gotoTimer=setInterval(function(){n._processGoto()},this.tick)},r.prototype._timelinePlay=function(){if(!(this.timer>0||e.isEmpty(this.data))){this.logger._debug("play "),this.status=this.STATUS_PROCESS;var i=this;this.lastTickTime=t.now();var s=e.values(this.activeWgts);s.length>0&&t.each(s,function(t,e){e.obj._timelineGoto(i.time-e.start),e.obj._timelinePlay()}),this._process(),this.timer=setInterval(function(){i._process()},this.tick)}},r.prototype._process=function(){var i=this;if(this.points.length>0&&this.time>=this.points[0].time&&(this.engine.addEvent("timeline",this.points[0].index,{broadcast:!0}),this.points.shift()),this.time>this.endTime)return this._timelineStop(!1),void this.engine.addEvent("timeline","end",{broadcast:!0});var s=!0;if(-1!=this.nextEndTime&&this.time>=this.nextEndTime&&this.ascEndTimeWgts.length>0){var r=this.ascEndTimeWgts.shift();e.isArray(r)&&(t.each(r,function(t,e){void 0!=i.activeWgts[e.id]&&(e.obj._timelineStop(!1),delete i.activeWgts[e.id],i.refAudio&&i.refAudio.id==e.id&&i._clearRefAudio())}),this._modifyNextEndTime())}var n=t.now(),o=this.time+n-this.lastTickTime;if(-1!=this.nextStartTime&&this.time>=this.nextStartTime&&this.ascStartTimeWgts.length>0){this.logger._debug("correction time "+this.time+" to "+this.nextStartTime),this.time=this.nextStartTime;var r=this.ascStartTimeWgts[0];r=r.concat(e.values(this.activeWgts));var a=!1;if(void 0==this.refAudio&&t.each(r,function(t,e){return e.isAudio?(i.refAudio=e,a=!0,!1):void 0}),e.isArray(r)){if(a){var h=r.length;t.each(r,function(t,s){s.obj._timelineStop(e.contains(e.keys(i.activeWgts),s.id)?!0:!1),s.obj._timelineGoto(i.time-s.start)&&h--,s.obj._timelineGoto(i.time-s.start)}),this.waitAudioCount++,this.waitAudioCount>this.maxWaitAudioCount&&(h=0)}else r=e.without(r,this.refAudio),h=r.length,t.each(r,function(t,e){e.obj._timelineGoto(i.time-e.start),h--});0==h?(this.waitAudioCount=0,this.ascStartTimeWgts.shift(),t.each(r,function(t,s){e.contains(e.keys(i.activeWgts),s.id)||(i.activeWgts[s.id]=s),s.obj._timelinePlay()}),this.lastTickTime=t.now(),this._modifyNextStartTime(),this.time=o):(s=!1,a&&i._clearRefAudio())}}s?this._addTime():this.lastTickTime=t.now()},r.prototype._timelineStop=function(i){if(this.logger._debug("stop ... "),this.status!=this.STATUS_STOP){this.status=this.STATUS_STOP,clearInterval(this.timer),clearInterval(this.gotoTimer),this.timer=-1,this.gotoTimer=-1,0!=this.time&&this._addTime();var s=this;if(e.isObject(this.activeWgts)){var r=e.values(this.activeWgts);r.length>0&&t.each(r,function(t,e){!i&&e.isFixToEnd?e.obj._timelineStop(!0,s.time-e.start,i):e.obj._timelineStop(i,s.time-e.start,i)})}i||(this.activeWgts={}),this.logger._debug("stop ok ")}},r.prototype._destroy=function(){this._timelineStop(!1),this.status=this.STATUS_DEAD,this.engine=void 0,this.waitCount=0,this.gotoTimer=-1,this.endTime=0,this.time=0,this.timer=-1,this.points=void 0,this.data=void 0,this.ascStartTimeWgts=void 0,this.ascEndTimeWgts=void 0,this.nextStartTime=-1,this.nextEndTime=-1,this.lastTickTime=-1,this.activeWgts=void 0,this.refAudio=void 0,this.logger._debug("destroy")},r.prototype._addTime=function(){if(void 0==this.refAudio){var e=t.now();this.time+=e-this.lastTickTime,this.lastTickTime=e}else{var i=Math.floor(1e3*this.refAudio.obj.getCurrentTime()+this.refAudio.start);this.time==i&&this.time+100>=this.refAudio.end?this.time=i+100:0!=i&&(this.time=i),this.lastTickTime=t.now()}this.logger._debug("time is "+this.time+"ms")},r.prototype._modifyNextStartTime=function(){this.nextStartTime=this.ascStartTimeWgts.length>0?this.ascStartTimeWgts[0][0].start:-1,this.logger._debug("next start time is "+this.nextStartTime+"ms")},r.prototype._modifyNextEndTime=function(){this.nextEndTime=this.ascEndTimeWgts.length>0?this.ascEndTimeWgts[0][0].end:-1,this.logger._debug("next end time is "+this.nextEndTime+"ms")},r.prototype._updateActiveWgts=function(e){var i=this;i.activeWgts={},t.each(this.data.wgts,function(t,s){e>=s.start&&e<=s.end?i.activeWgts[s.id]=s:s.obj._timelineStop(!1)})},r.prototype._processGoto=function(){var i=this,s=e.values(this.activeWgts),r=s.length;t.each(s,function(t,e){e.obj._timelineStop(!0),e.obj._timelineGoto(i.time-e.start)&&r--}),0==r?(t.each(s,function(t,e){e.obj._timelinePlay()}),this.waitCount=0,clearInterval(this.gotoTimer),this.gotoTimer=-1,this.play("play")):this.waitCount>this.maxWaitCount?(clearInterval(this.gotoTimer),this.gotoTimer=-1,this.play("play")):this.waitCount++},r.prototype.play=function(t){"play"==t?this._timelinePlay():"stop"==t?this._timelineStop(!0):this._destroy()},r.prototype.getWgtByID=function(t){return this.engine.getWgtByID(t)},r.prototype.getStatus=function(){return this.status},r.prototype.getTime=function(){return this.time>this.endTime?this.endTime:this.time},r.prototype.isAutoPlay=function(){return this.data&&this.data.autoplay===!1?!1:!0},r.prototype._clearRefAudio=function(){this.refAudio=void 0},r}),define("wgt/com.smartbuilder.axon.widget.frame/s",["module","sb4core/sbobj","sb4core/sbobjfactory","sb4core/DataUtil","underscore","sb4core/ObjContext","sb4core/SB4Engine","sb4core/SB4Decode","sb4core/data","widgets/com.smartbuilder.axon.widget.frame/timeline","underscore_str"],function(t,e,i,s,r,n,o,a,h,l){var c=t.config(),u=c.widgetsvc,d=u.getShortUIKey(),p,f,g=[],v;return $.widget(u.getFullUIKey(),$.sb4[e],{options:{},_create:function(){p=new createjs.LoadQueue(SB4API.preferXHR),p.setMaxConnections(10),f=new createjs.LoadQueue(SB4API.preferXHR),f.setMaxConnections(10),this.pageNumIdMap=h.lo.pageNumIdMap,this.pageIdNumMap=h.lo.pageIdNumMap,this.pageNumNameMap=h.lo.pageNumNameMap,this.searchData=h.lo.searchData,this.element.addClass(d);var t=this.options;this._super(),this.totalSceneCount=this.getFlowSceneCount(t._d.flow.subflow),null==t.hasBG?this.element.css("background-color","#FFFFFF"):1==t.hasBG&&this.element.css("background-color",s.parseColor(t.bgcolor));var e=r.find(h.lo.meta.entries,function(t){return"stagebgchoice"==t.id});if(0==e.value){var n=r.find(h.lo.meta.entries,function(t){return"stagebgcolor"==t.id});null!=n.cid?this.element.css("background-color","#"+n.cid):this.element.css("background-color","rgb("+s.getInt(n.R,0)+","+s.getInt(n.G,0)+","+s.getInt(n.B,0)+")")}else{var a=r.find(h.lo.meta.entries,function(t){return"stagebgimage"==t.id});this.element.css("background-image","url("+SB4API.util.getWidgetAssetURI(a.key)+")"),this.element.css("background-repeat","repeat"),this.element.css("background-color","")}this.element.css("overflow","hidden"),this.objctx=t._engine.objctx.fork(),this.objctx.add("_frame",this),SB4API.rootContext.add(["[frame]"],this),this.scene=null,this.subFlowMap={},this._initSubFlowMap(this.options._d.flow.subflow,"root"),this.engine=new o(t._i,null,this.objctx,"frame"),this.engine.objctx.add("[ctx_type]","frame"),t._engine.addEngine(this.engine),this.factory=new i(this.engine),this.mastermap=r.indexBy(t._d.slides,"id");var l=this;SB4API.getSearchResult=function(t,e){if(null==l.searchData||r.str.isBlank(t))return[];var i=!0;/^[\w\s,.]+$/.test(t)||(i=!1);var s;s=i?new RegExp("(?:\\S+\\s){0,2}\\S*"+t+"\\S*(?:\\s\\S+){0,2}","gi"):new RegExp("(.{0,10}"+t+".{0,10})","gi");var n=new RegExp(t,"gi"),o=r.map($(".sceneMasterLayer"),function(t){return $(t).attr("id")}),a=[];r.each(r.pick(l.searchData.masterPages,o),function(t){r.each(r.values(t),function(t){r.each(t.text,function(t){a=a.concat(r.map(t.match(s),function(t){return t.replace(n,e)}))})})});var h=r.map(l.searchData.localPages,function(t,i){var o=[];r.each(r.values(t),function(t){r.each(t.text,function(t){o=o.concat(r.map(t.match(s),function(t){return t.replace(n,e)}))})}),i==SB4API.currentScene.id&&(o=o.concat(a));var h={};return h.id=i,h.number=l.pageIdNumMap[i],h.name=l.pageNumNameMap[h.number],h.text=o,h});return h};var c=this.objctx,u=t._d.blockDefRegistry;void 0!=u&&r.each(u.defs,function(t){c.add("global "+t.name)});var g;t.selectedScene?(g=this._findHashSceneByID(this.options._d.flow.subflow,t.selectedScene),t.selectedScene=null,null==g&&(g=this._selectNextScene({cmd:"restart"}))):g=this._selectNextScene({cmd:"restart"}),g=this._findFinalScene(g),g&&this._revertScene(g)},_selectNextScene:function(t){var e=null,i=this.options._d;if("restart"==t.cmd)e=i.flow;else if("sb4_goto_branch"==t.cmd){var s=this.scene.flows;if("_next"==t.v)e=void 0==this.scene.flows||r.isEmpty(s)?this._findNextSceneAfterSubflow(this.scene.id):s[0];else if("_nextRandom"==t.v)e=void 0==this.scene.flows||r.isEmpty(s)?this._findNextSceneAfterSubflow(this.scene.id):r.sample(s);else if("_prev"==t.v){var n=this._findSceneId(this.scene.id);e=this._findPrevSceneByBranchID(this.options._d.flow.subflow,n)}else r.str.isBlank(t.v)||(e=r.find(s,function(e){return e.id==t.v}))}else"global_sb4_goto_scene"==t.cmd?e=this._findHashSceneByID(this.options._d.flow.subflow,t.v):"reload"==t.cmd&&(e=this.scene);return e},_findHashSceneByID:function(t,e){if(r.str.isBlank(e)||null==t)return null;var i=t.subflow;if(null!=i){if(i.id==e)return i;if(n=this._findHashSceneByID(i,e),null!=n)return n}if(t.id==e)return t;var s=t.flows,n=null;if(null!=s)for(var o in s)if(n=this._findHashSceneByID(s[o],e),null!=n)break;return n},_findSceneByID:function(t,e){if(r.str.isBlank(e)||null==t)return null;if(t.id==e)return t;var i=t.flows;if(void 0==i)return null;var s=null;for(var n in i)if(s=this._findSceneByID(i[n],e),null!=s)break;return s},_findPrevSceneByBranchID:function(t,e){if(r.str.isBlank(e)||null==t)return null;var i=t.flows;for(var s in i)if(i[s].id==e)return t;var n=null;for(var s in i)if(n=this._findPrevSceneByBranchID(i[s],e),null!=n)break;if(null==n){var o=t.subflow;null!=o&&(o.id==e?n=t:o.flows&&(n=this._findPrevSceneByBranchID(o,e)))}return n},_findSceneId:function(t){var e=this._findHashSceneByID(this.options._d.flow.subflow,this.subFlowMap[t]);if(null!=e){var i=e.subflow;if(r.str.isBlank(t)||null==i)return null;if(null!=e&&i.id==t)return t=e.id,this._findSceneId(t)}return t},_findNextSceneAfterSubflow:function(t){var e=null,i=this._findHashSceneByID(this.options._d.flow.subflow,this.subFlowMap[t]);return null!=i&&(e=void 0!=i.flows&&r.size(i.flows)>0?i.flows[0]:this._findNextSceneAfterSubflow(i.id)),e},_renderScene:function(t){if(0!=$("#playFull").length&&1==SB4API.mediaAutoPlayAuthorization)return void this.engine.objctx.add("playFull_scene",t);if(null==t)return void SB4API.hideLoadingWithOpacity();SB4API.stageLog(r.has(SB4API.queryMap,"mid")?this.mastermap[SB4API.queryMap.mid]?"render master :  name is "+this.mastermap[SB4API.queryMap.mid].name:"render master :  can not find valid master by mid="+SB4API.queryMap.mid:"render scene : num is "+this.pageIdNumMap[t.id]+" , name is "+t.name);var e=this.scene;this.scene=t;var n=this.scene.id;this.options._h=t.time&&t.time>0?t.time:SB4API.profile.current.h,this.element.height(this.options._h),$("body").scrollTop(0),0!=$("#playFull").length&&0==SB4API.mediaAutoPlayAuthorization&&0==$("#playButton").length&&$(document).ready(function(){SB4API.playButtonBackgroundColor?$("#playFull").css("background-color",SB4API.playButtonBackgroundColor):$("#playFull").css("background-color","rgba(255,255,255,0.8)");var t=0;1==SB4API.tabOrder&&(t=1);var e=$('<div id="playButton" style="width: 150px;height: 150px;position:absolute;"><div class="notouch" style="width: 100%; height: 100%; position: absolute"><button tabindex="'+t+'" class="" style="width: 100%; height: 100%;border: none; background-color: rgba(255,255,255,0);" aria-label="Authorize media to autoplay."></button></div><svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"	 width="150px" height="150px" viewBox="0 0 92 92" enable-background="new 0 0 92 92" xml:space="preserve"><g>	<path fill="#6B6B6B" d="M46,8c20.953,0,38,17.047,38,38S66.953,84,46,84C25.047,84,8,66.953,8,46S25.047,8,46,8 M46,1		C21.147,1,1,21.147,1,46c0,24.854,20.147,45,45,45c24.851,0,45-20.146,45-45C91,21.147,70.852,1,46,1L46,1z"/>	<path fill="#6B6B6B" d="M38.167,25.147c-0.368,0-0.736,0.085-1.077,0.257c-0.802,0.406-1.309,1.229-1.309,2.129v37.725		c0,0.899,0.506,1.723,1.309,2.129c0.34,0.172,0.71,0.257,1.077,0.257c0.5,0,0.996-0.156,1.414-0.463l25.667-18.863		c0.611-0.45,0.973-1.164,0.973-1.923c0-0.759-0.361-1.473-0.973-1.923L39.58,25.61C39.163,25.304,38.666,25.147,38.167,25.147		L38.167,25.147z"/></g></svg></div>');e.appendTo("#playFull"),$("#playFull").show();var i=$(".com_smartbuilder_axon_widget_frame").eq(0),s,r;s=document.documentElement.clientWidth>i.width()?parseInt((i.width()-$("#playButton").width())/2)+i.offset().left+"px":parseInt((document.documentElement.clientWidth-$("#playButton").width())/2)+i.scrollLeft()+"px",r=document.documentElement.clientHeight>i.height()?parseInt((i.height()-$("#playButton").height())/2)+i.offset().top+"px":parseInt((document.documentElement.clientHeight-$("#playButton").height())/2)+i.scrollTop()+"px",$("#playButton").css("left",s),$("#playButton").css("top",r),$("#playFull").on("click",function(){$.each($("audio"),function(t,e){e.load()}),SB4API.setAudioCapable(),$.each($("video"),function(t,e){$(e).hasClass("video-unused")?(e.setAttribute("src",""),e.load()):e.load()}),"undefined"!=typeof window.orientation||$("#media").empty(),$("#playFull").remove()})});var o=!1,a=0,h=0;SB4API.currentFrameSize&&(a=this.options._h-SB4API.currentFrameSize._h,h=this.options._w-SB4API.currentFrameSize._w,(0!=a||0!=h)&&(o=!0)),SB4API.currentFrameSize={_w:this.options._w,_h:this.options._h},SB4API.currentScene={name:this.scene.name,id:n,num:this.pageIdNumMap[n]},SB4API.updateScale(SB4API.profile.current),SB4API.updateProfile(SB4API.profile.current.id),o&&"function"==typeof onSceneHeightChange&&onSceneHeightChange(),SB4API.hideLoadingWithOpacity(),r.isObject(SB4API.xapi.tincan)&&SB4API.xapi.pageVisit(this.scene.name,this.pageIdNumMap[n]);var l=this,c=t.slides,u=t.layers,d=[];void 0!=u&&(d=d.concat(u));var p=r.map(this.mastermap,function(t,e){return t});d=d.concat(p);var f=r.indexBy(d,"id"),g=[];for(var v in c){var m=c[v],b=f[s.trimRefString(m.$ref)];void 0!=b&&g.push(b)}var _=r.indexBy(g,"id"),x={};this.element.children(".com_smartbuilder_axon_widget_slide, .com_smartbuilder_axon_widget_slideset").each(function(t,e){var i=$(e),s=i.attr("id");_[s]&&i.hasClass("sceneMasterLayer")&&(x[s]=i)});var y={};y["[evtval]"]=SB4API.profile.current.d,this.sceneLocalEngine=this.engine.addSubEngine(n,"local"),this.sceneLocalEngine.objctx.add("[ctx_type]","local"),this.sceneLocalEngine.objctx.add("[var_widget_id_map]",{}),this.sceneLocalEngine.eventQueue.push(["flow","load",y]),r.each(r.keys(x),function(t,e){var i=l.engine.getSubEngineByID(t);i&&i.eventQueue.push(["flow","change",y])});var w=[];for(var S in g){var T=g[S].id,I=null;if(x[T]){I=$("#"+T,this.element);var B=l.engine.getSubEngineByID(T);B&&r.map(r.uniq(r.values(B.initObjctx.map)),function(t){if(s.isWgt(t))if(t.element.hasClass("float_axon_sbobj"))s.floatWidgetPosition(t);else if(o){var e=t._getCurrentProfile();if(null!=e&&("B"==e.f.v||"R"==e.f.h)){var i=t.getPos();"B"==e.f.v&&(i.top=i.top+a),"R"==e.f.h&&(i.left=i.left+h),t.setPos(i)}}})}else{var A=null,E="sceneLocalLayer";if(this.mastermap[T]){var P=this.engine.addSubEngine(T,this.mastermap[T].name);P.objctx.add("[ctx_type]","master"),P.objctx.add("[var_widget_id_map]",{}),P.eventQueue.push(["flow","load",y]),P.addEngineEventListener(l),A=new i(P),E="sceneMasterLayer"}else A=new i(this.sceneLocalEngine);for(var C=null,k=parseInt(S)+1;k<g.length;k++){var O=g[k].id;if(x[O]){C=O;break}}var M=null;M=null!=C?A._createObjDivBefore($("#"+C)):A._createObjDiv(this.element);var L=A._createObj(M,g[S],this.element,"SlideSet");L.addClass(E),A._activateObjDiv(M,void 0!=L),w.push($(L)),I=L,x[T]=I,"sceneMasterLayer"==E&&g[S].actions&&$.each(g[S].actions,function(t,e){P.parseXml(e.val)})}}t.actions&&$.each(t.actions,function(t,e){l.sceneLocalEngine.parseXml(e.val)});var D=this.element.children().detach(),V=[];r.each(c,function(t){V.push(r.find(D,function(e){return s.trimRefString(t.$ref)==$(e).attr("id")}))}),this.element.append(V),this.sceneLocalEngine.addEngineEventListener(this);var R={};R.id=n,R.name=t.name,SB4API.flowcontext.setContext(R);var F=[];r.each(SB4API.cacheSvgIdList,function(t,e){0==$("."+t).length?$("#svg_"+t).remove():F.push(t)}),SB4API.cacheSvgIdList=F,SB4API.pageLaunchTime=$.now(),this.afterRenderScene(w,t)},afterRenderScene:function(t,e){this._util.floatWidgetsPosition(),this.engine.start();var i=this;SB4API.stageLog("stage ready"),$.each(t,function(t,e){i.sceneLocalEngine.invokeWidgetMethod(e,"_onStageReady"),i.sceneLocalEngine.invokeWidgetMethod(e,"_onParentShowHide",[!0,!0])}),this.timeline=new l(this.sceneLocalEngine,e.timeline),this.timeline.isAutoPlay()&&this.timeline.play("play"),this._util.calculateTabindex(),this.engine.objctx.add("_timeline",this.timeline),SB4API.flowcontext.fireEvent(),this.element.append($("<div class='sb_nvda_508_trigger' style='width: 0px;height: 0px;'></div>")),$("#playerstage").append($("<div class='sb_nvda_508_trigger' style='width: 0px;height: 0px;'></div>")),setTimeout(function(){$(".sb_nvda_508_trigger").remove()},500)},onEngineEvent:function(t,e,i,s){("onHide"==i||"onShow"==i||"onMove"==i)&&(this.debounce||(this.debounce=r.debounce(this._util.calculateTabindex,300)),this.debounce());var s=r.clone(s);if(null!=s&&s.broadcast){s.broadcast=!1;for(var n=0;n<this.engine.subEngines.length;n++)t!=this.engine.subEngines[n]&&this.engine.subEngines[n].addEvent(e,i,s)}else"flow"==e?(s.cmd=i,("sb4_goto_branch"==i||"restart"==i||"global_sb4_goto_scene"==i||"reload"==i)&&this.onEnginePageEvent(i,s)):this.mastermap[t.id]},onEnginePageEvent:function(t,e){var i=this,s;"sb4_goto_branch"==t||"restart"==t||"global_sb4_goto_scene"==t||"reload"==t?(e.cmd=t,this.cmd=t,s=this._selectNextScene(e)):"sb4_goto_scene_by_name"==t?s=this.gotoSceneByName(this.options._d.flow.subflow,e.name):"sb4_goto_branch_by_name"==t?s=this.gotoBranchByName(e.name):"sb4_goto_scene_by_id"==t&&(s=this._findHashSceneByID(this.options._d.flow.subflow,e.id)),s=this._findFinalScene(s),s&&(this.engine.stop(),i._revertScene(s))},_findFinalScene:function(t){if(t=this.getSenceSubFlow(t),null==t)return null;var e=this.scene;return"restart"!=this.cmd&&"reload"!=this.cmd&&null!=e&&e.id==t.id?null:t},_destroy:function(){this.engine.destroy(),this.engine=null,this.mastermap=void 0,this.objctx=null,this.factory=null,this._super()},_revertScene:function(t){if(null!=t){this.cmd=null;var e=this,i=t.slides,n=[];for(var o in i){var l=i[o],c=s.trimRefString(l.$ref);void 0!=c&&n.push(c)}this.timeline&&this.timeline.play("destroy");var u=[];this.sceneLocalEngine&&(u.push(this.sceneLocalEngine.id),this.sceneLocalEngine.destroy()),this.element.children(".com_smartbuilder_axon_widget_slide, .com_smartbuilder_axon_widget_slideset").each(function(t,i){var s=$(i),o=s.attr("id");if(r.contains(n,o)&&s.hasClass("sceneMasterLayer"));else{if(s.hasClass("sceneMasterLayer")){var a=e.engine.getSubEngineByID(o);a&&(u.push(a.id),a.destroy())}var h=e._getElementWidgetInstance(i);h.destroy(),s.remove()}}),this.engine._purgeSubEngine();var d=[];r.each(r.keys(this.engine.objctx.map),function(t,i){var s=e.engine.objctx.map[t];r.str.startsWith(t,"[fn:")&&r.contains(u,s.engineId)&&d.push(t)}),r.each(d,function(t,i){e.engine.objctx.remove(t)}),SB4API.showLoadingWithOpacity();var f=function _(i){var s=[],n=r.keys(e.mastermap);n.length>0&&void 0==e.mastermap[n[0]].name&&(r.isArray(master)||(master=a.decodeSb4Data(master)),a.revertLoColor(master,h.text.glyphReg.colorData),h.lodict.id&&a.revertTextWgtId(master,h.lodict.id),a.decodeLO(master,h.lodict),this.mastermap=r.indexBy(master,"id"),$.each(master,function(t,e){if(e.textReg){var i=r.keys(e.textReg);$.each(i,function(t,i){var s=i.split(".")[0],n=e.textReg[i];if(r.isObject(n)&&r.has(n,"refid")){var o=n.refid;n.refid=h.lodict.id[o.substring(0,o.indexOf("."))]+o.substring(o.indexOf("."))}SB4API.txtLib.textReg[h.lodict.id[s]+i.substring(s.length)]=n})}}),e.mastermap=r.indexBy(master,"id"));var o;o=h.lodict.id?g[t.id]:t.id,"undefined"==typeof local&&(local=void 0),void 0==local&&(local=t.layers),void 0!=local&&p.getResult(o)&&(r.isObject(local)||(local=a.decodeSb4Data(local)),a.revertLoColor(local,h.text.glyphReg.colorData),h.lodict.id&&a.revertTextWgtId(local,h.lodict.id),a.decodeLO(local,h.lodict),local.textReg&&(SB4API.txtLib.textReg=r.extend(SB4API.txtLib.textReg,local.textReg)),t.actions=local.actions,t.layers=local.layers),e._preloadResources(t,s)};if(p.removeAllEventListeners(),p.on("complete",f),t.layers)this._preloadResources(t,[]);else{var g=r.invert(h.lodict.id),v=[],m=r.keys(this.mastermap);m.length>0&&void 0==this.mastermap[m[0]].name&&v.push({src:SB4API.addBustParam("app/master.js"),id:"master"});var b={};h.lodict.id?(b.src=SB4API.addBustParam("app/scene_"+g[t.id]+".js"),b.id=g[t.id]):(b.src=SB4API.addBustParam("app/scene_"+t.id+".js"),b.id=t.id),v.push(b),p.loadManifest(v)}}},_preloadResources:function(t,e){var i=this,s=function(e){t["preloadResources"+SB4API.profile.current.id]=!0,i._renderScene(t)},n=function(t){};if(t["preloadResources"+SB4API.profile.current.id])this._renderScene(t);else if(this._findPreloadResources(t,e),r.isEmpty(e))t["preloadResources"+SB4API.profile.current.id]=!0,i._renderScene(t);else{for(var o=[],a=0;a<e.length;a++)o.push({id:e[a],src:e[a]});f.loadManifest(o),f.removeAllEventListeners(),f.on("complete",s),f.on("error",n)}},_findPreloadResources:function(t,e){var i=this,n=[];this._findWgts(t.layers,n);var o=r.map(t.layers,function(t){return t.id});$.each(t.slides,function(t,e){var a=s.trimRefString(e.$ref);null==a||r.contains(o,a)||i._findWgts(i.mastermap[a].slides,n)}),$.each(n,function(t,s){null!=s.data.entries&&i._findPreloadResourcesByWgt(s.data.entries,e,s.type)})},_isAlreadyPreload:function(t,e){return t=SB4API.util.getWidgetAssetURI(t,e),r.contains(g,t)?!0:(g.push(t),!1)},_findPreloadResourcesByWgt:function(t,e,i){var s=this,n=SB4API.profile.current.id,o=r.find(t,function(t){return"_prf"==t.id});if(o){var a=r.find(o.subs,function(t){return t.id==n});if(a){var h=a.subs;if(r.isArray(h)){var l=r.map(h,function(t){return t.id}),c=r.reject(t,function(t){return r.contains(l,t.id)});t=h.concat(c)}}}s._isPreloadRes(t)?$.each(t,function(t,n){"ResData"==n.eClass&&n.key&&(s._isAlreadyPreload(n.key,i)||e.push(r.last(g)))}):$.each(t,function(t,n){"pload"==n.id&&"ResData"==n.eClass&&(s._isAlreadyPreload(n.key,i)||e.push(r.last(g)),r.isArray(n.subs)&&$.each(n.subs,function(t,n){s._isAlreadyPreload(n.key,i)||e.push(r.last(g))}))})},_findWgts:function(t,e){var i=this;if(r.isArray(t))$.each(t,function(t,s){i._findWgts(s,e)});else if(r.isObject(t))if(r.isArray(t.widgets)&&!r.isEmpty(t.widgets))$.each(t.widgets,function(t,i){e.push(i)});else for(var s in t)"object"==typeof t[s]&&this._findWgts(t[s],e)},_isPreloadRes:function(t){var e=!1;return null!=t?$.each(t,function(t,i){"preload"==i.id&&1==i.value&&(e=!0)}):e=!0,e},_timelineGoto:function(t){return this.timeline._timelineGoto(t)},_timelinePlay:function(){this.timeline.play("play")},_timelineStop:function(){this.timeline.play("stop")},gotoSceneByName:function(t,e){var i=this.findSceneByName(t,e);return i},findSceneByName:function(t,e){if(null==t)return null;var i=t.subflow;if(null!=i){if(i.name.toLowerCase()==e.toLowerCase())return i;if(r=this.findSceneByName(i,e),null!=r)return r}if(t.name.toLowerCase()==e.toLowerCase())return t;var s=t.flows,r=null;if(null!=s)for(var n in s)if(r=this.findSceneByName(s[n],e),null!=r)break;return r},_initSubFlowMap:function(t,e){if(null==t)return null;this.subFlowMap[t.id]=e;var i=t.subflow;null!=i&&this._initSubFlowMap(i,t.id);var s=t.flows;if(null!=s)for(var r in s)this._initSubFlowMap(s[r],e)},exitFlow:function(){var t=this._findExitFlowNextScene(this.scene);this._revertScene(this.getSenceSubFlow(t))},_findExitFlowNextScene:function(t){var e=this.subFlowMap[t.id];if("root"!=e){var i=this._findHashSceneByID(this.options._d.flow.subflow,e);if(null!=i)return r.isArray(i.flows)&&r.size(i.flows)>0?i.flows[0]:this._findExitFlowNextScene(i)}},getBranchNames:function(){var t=this.scene.flows;return r.size(t)>0?r.map(t,function(t){return t.name}):[]},getBranchNums:function(){var t=this.scene.flows;if(r.size(t)>0){var e=this;return r.map(t,function(t){return e.pageIdNumMap[t.id]})}return[]},getSenceSubFlow:function(t){return null!=t&&null!=t.subflow?(t=t.subflow,this.getSenceSubFlow(t)):t},gotoBranchByName:function(t){var e=this.scene.flows,i=null;if(null!=e)for(var s in e)if(e[s].name.toLowerCase()==t.toLowerCase()){i=e[s];break}return i},getFlowSceneCount:function(t){var e=1,i=t.subflow;null!=i&&(e=e+this.getSubFlowSceneCount(i)-1);var s=t.flows;if(null!=s){var r=this;$.each(s,function(t,i){e+=r.getFlowSceneCount(i)})}return e},getSubFlowSceneCount:function(t){var e=1,i=t.flows;if(null!=i){var s=this;$.each(i,function(t,i){e+=s.getFlowSceneCount(i)})}return e},_play:function(){this._super()&&this.timeline&&this.timeline.play("play")},_stop:function(){this._super(),this.timeline.play("stop")},_isPlaying:function(){return this._super(),void 0!=this.timeline&&this.timeline.getStatus()==this.timeline.STATUS_PROCESS?!0:!1},changeProfile:function(t){this.options._w=t.w;var e=this.scene.id,i=t.hMap;this.options._h=i[e]?i[e]:t.h,this.element.width(this.options._w),this.element.height(this.options._h),SB4API.alignToBody(),$("body").scrollTop(0),SB4API.currentFrameSize={_w:this.options._w,_h:this.options._h},this._super(t)},preloadResourcesBeforeChangeProfile:function(){var t=this,e=function(e){t.scene["preloadResources"+SB4API.profile.current.id]=!0},i=function(t){};if(!t.scene["preloadResources"+SB4API.profile.current.id]){var s=[];if(this._findPreloadResources(t.scene,s),r.isEmpty(s))t.scene["preloadResources"+SB4API.profile.current.id]=!0;else{for(var n=[],o=0;o<s.length;o++)n.push({id:s[o],src:s[o]});f.loadManifest(n),f.removeAllEventListeners(),f.on("complete",e),f.on("error",i)}}}}),d}),define("wgt/com.smartbuilder.axon.widget.slideset/s",["module","sb4core/sbobj"],function(t,e,i){var s=t.config(),r=s.widgetsvc,n=r.getShortUIKey(),o="com_smartbuilder_axon_widget_slide",a="."+o;return $.widget(r.getFullUIKey(),$.sb4[e],{options:{mode:0},_create:function(){this.element.addClass(n),this._super(),this.idx=-1,this.list=null},_onStageReady:function(){var t=this,e=this.options,i=e._engine;this.element.children(a).each(function(i,s){if(0==i)return void $(s).removeClass(o);var r=$(s).data("sb4-"+$(s).data("sb4type"));1==e.mode?1==r._vv&&(t.idx=i-1):1==r._vv&&(t.idx=i-1)}),this.list=this.element.children(a),this._super()},_paintWidgetShow:function(t){var e=this;if(_.has(t,"idx")){var i=t.idx;this.element.children(a).each(function(i,s){var r=$(s).data("sb4-"+$(s).data("sb4type"));0==r._vv&&r.hide(t.hidefx,e)});var s=!0,r=!1;this.element.children(a).each(function(i,n){var o=$(n).data("sb4-"+$(n).data("sb4type"));1==o._vv&&(o.show(t.showfx,e),e.fireEvent("onAnyLayerShown"),r=!0),0==o.visited&&(s=!1)}),r||e.fireEvent("onAllLayerHidden"),this.idx=i,e.fireEvent("onLayerChange"),1==s&&1!=e.firedAllVisisted&&(e.firedAllVisisted=!0,e.fireEvent("onAllLayerViewed"))}this._super()},showSlide:function(t){t=this._util.parseInt(t);var e=this._getSlideRef(t);null!=e&&this._showSlide(!0,e)},hideSlide:function(t){t=this._util.parseInt(t);var e=this._getSlideRef(t);null!=e&&this._showSlide(!1,e)},showNextPrevSlide:function(t){if(this.idx<0&&(this.idx=-1),"_next"==t){if(this.idx+2>this.list.length)return;this.showSlide(this.idx+2)}else if("_prev"==t){if(this.idx-1<0)return;this.showSlide(this.idx)}},getVisibleLayerIndexList:function(){var t=[];return 1==this.getVisible()&&this.element.children(a).each(function(e,i){var s=$(i).data("sb4-"+$(i).data("sb4type"));1==s._vv&&t.push(e+1)}),t.join()},getVisibleLayers:function(){var t=[],e=this;return 1==this.getVisible()&&this.element.children(a).each(function(i,s){var r=e._getSlideRef(i+1);1==r._vv&&t.push(r)}),t},_getSlideRef:function(t){if(1>t)return null;var e=this.element.children(a).eq(t-1);return 0==e.length?null:e=e.data("sb4-"+e.data("sb4type"))},_getSlideIdxByRef:function(t){return this.list.index(t.element)},_showSlide:function(t,e,i){var s=this,r=this.options,n=r._engine,o=this._getSlideIdxByRef(e);if(this.element.children(a).each(function(i,s){var n=$(s).data("sb4-"+$(s).data("sb4type"));1==r.mode?n==e&&(n._vv=t):1==t?n._vv=n==e?!0:!1:n==e&&(n._vv=!1)}),0!=r.mode||0!=t||this.idx==o){var h={idx:o};1==t?h.showfx=i:h.hidefx=i,this._firePaintRequest(h)}},getSlideCount:function(){return this.list.length},getSize:function(){return this.options._p.getSize()}}),n}),define("wgt/com.smartbuilder.axon.widget.slide/s",["module","sb4core/sbobj"],function(t,e,i){var s=t.config(),r=s.widgetsvc,n=r.getShortUIKey();return $.widget(r.getFullUIKey(),$.sb4[e],{options:{},_create:function(){this.element.addClass(n),this._super(),this.visited=!1},_onStageReady:function(){var t=this,e=this.options,i=e._engine;this._super()},show:function(t,e){var i=this.options;if(e==i._p||"_showOrHide"==e){this.visited=!0;var s=i._engine.objctx.get(SB4API._OBJECT_KEY.EFFECT_TIME);this._super(t,e,s)}else i._p._showSlide(!0,this,t)},hide:function(t,e){var i=this.options;if(e==i._p||"_showOrHide"==e){var s=i._engine.objctx.get(SB4API._OBJECT_KEY.EFFECT_TIME);this._super(t,e,s)}else i._p._showSlide(!1,this,t)},getSize:function(){return this.options._p.getSize()},_refreshFxElement:function(){this.element.children(".axon_sbobj").each(function(t,e){var i=$(e).data("sb4-"+$(e).data("sb4type"));i._refreshFxElement()})},setSlideVisiblityWithParent:function(t){var e=this.options;"show"==t?(e._p._showSlide(!0,this),e._p.show()):"hide"==t&&(e._p.hide(),e._p._showSlide(!1,this))},_paintWidgetShow:function(t){this.visited=!0,this._super()}}),n}),define("text!widgets/com.smartbuilder.axon.widget.shape/svg.html",[],function(){return'<div\r\n	style="position: relative; text-align: center; width: 100%; height: 100%;">\r\n	<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg"\r\n		xmlns:xlink="http://www.w3.org/1999/xlink"\r\n		xmlns:svg="http://www.w3.org/2000/svg"\r\n		contentScriptType="text/ecmascript" display="block" width="100%" zoomAndPan="magnify"\r\n		contentStyleType="text/css" height="100%" preserveAspectRatio="none"\r\n		version="1.0">\r\n		'
}),define("lib/css!widgets/com.smartbuilder.axon.widget.shape/style",[],function(){}),define("text!widgets/com.smartbuilder.axon.widget.shape/text.html",[],function(){return'</svg>\r\n<div id="text"></div>\r\n</div>'}),define("wgt/com.smartbuilder.axon.widget.shape/s",["module","sb4core/sbobj","text!widgets/com.smartbuilder.axon.widget.shape/svg.html","css!widgets/com.smartbuilder.axon.widget.shape/style.css","text!widgets/com.smartbuilder.axon.widget.shape/styles.xml","text!widgets/com.smartbuilder.axon.widget.shape/text.html"],function(t,e,i,s,r,n){var o=t.config(),a=o.widgetsvc,h=a.getShortUIKey();return $.widget(a.getFullUIKey(),$.sb4[e],{options:{},_create:function(){null==this.stateChangeMap&&(this.stateChangeMap={}),this.element.addClass(h),this._super(),this.applyProfileFlag||(this.clkCnt=0,this.lineWidth=this.options.lineWidth,this.linecolor=this.options.line,this.transparency=this.options.transparency,this.textValue=this.options.text,this.textColorValue=this.options.fontColor,this.scaleValue=100,this.oldscaleValue=this.scaleValue,this.filllist=JSON.parse(this.options.filllist)),this.currentBoundingWidth=this.options.currentBoundingWidth,this.currentBoundingHeight=this.options.currentBoundingHeight,this.currentWidth=this.options._w,this.currentHeight=this.options._h,this.top=parseInt(this.options._y+(this.currentBoundingHeight-this.currentHeight)/2),this.left=parseInt(this.options._x+(this.currentBoundingWidth-this.currentWidth)/2),_.has(this.stateChangeMap,"angle")||(this.angle=this.options.rotation),this.textPadding=this.options.textPadding,this.textVerticalAlign=this.options.textVerticalAlign,this.rootshapeId=_.uniqueId("rootshape_"),this.rootshapeJQueryId="#"+this.rootshapeId,this.rootshapeGroupId=this.rootshapeId+"_g",this.rootshapeShadowId=this.rootshapeId+"_shadow",this.element.addClass("notouch"),this.attr={},this.options.underline&&(this.attr.textDecoration="underline");var t=this.left-this.getPosOffset(),e=this.top-this.getPosOffset(),i=this.options._w+this.getSizeOffset(),s=this.options._h+this.getSizeOffset();this.element.css("left",t+"px"),this.element.css("top",e+"px"),this.element.css("width",i+"px"),this.element.css("height",s+"px");var r="";if(null!=this.options.image&&this.options.image.length>0){var n=a.getWidgetAssetURI(this.options.image);r='<pattern id="'+this.options._i+'simg" patternUnits="userSpaceOnUse"  width="'+this.options._w+'" height="'+this.options._h+"\"> <image aria-hidden='true' width=\""+this.options._w+'" height="'+this.options._h+'" preserveAspectRatio="none" xlink:href="'+n+'" ></image></pattern>'}if(this.shadowValue=this.options.shadow,this._createShape(r),void 0!=this.shadowValue&&"use"==this.shadowValue.shadow){this.shadowdiv=$("<div>").prependTo(this.element),this.shadowdiv.attr("class","notouch"),this.shadowdiv.html(this._util.createShadowSvg(this.rootshapeShadowId,this.rootshapeGroupId,this.shadowValue,i,s)),this.options.margin>0&&($("#"+this.rootshapeShadowId).attr("x",this.options.margin),$("#"+this.rootshapeShadowId).attr("y",this.options.margin)),this.shadowdiv.attr("style","position:absolute; text-align:center;");var o=this.getShadowBounds();this.setTextStyleValue(this.shadowdiv,o[1],o[0],o[2],o[3]),this.element.find("#"+this.rootshapeId+"_shadow").css("opacity",this._util.getOpacityByTransparency(this.transparency))}this.element.css("transform","rotate("+this.angle+"deg)"),this.element.find(this.rootshapeJQueryId).attr("transform","translate("+this.getTranslateValue()+","+this.getTranslateValue()+")"),100!=this.scaleValue&&this.refreshScale(this.scaleValue)},_createShape:function(t){var e="";if("use"==this.shadowValue.shadow&&(e=this.options.group.replace(/rootshape/g,this.rootshapeGroupId)),this.div=$(i+"<defs>"+t+e+"</defs>"+this.options.group.replace(/rootshape/g,this.rootshapeId)+"</svg></div>"),this.div.appendTo(this.element),$(this.rootshapeJQueryId).attr("style",this.options.styleValue.replace("simg",this.options._i+"simg")),this.options.hand&&$(this.rootshapeJQueryId).css("cursor","pointer"),this.fillcolor)$(this.rootshapeJQueryId).css("fill",this.fillcolor);else if("none"!=this.filllist[0].typeValue){this.element.find(this.rootshapeJQueryId).css("pointer-events","painted");var s=this.filllist[0];if("gradient"==s.typeValue){var r='<linearGradient x1="'+s.x1+'" y1="'+s.y1+'" x2="'+s.x2+'" y2="'+s.y2+'">';_.each(s.stopList,function(t,e){r+='<stop stop-color="rgb('+t.color.red+","+t.color.green+","+t.color.blue+')" offset="'+t.position+'%" stop-opacity="'+(1-t.opacity/100)+'"></stop>',1==s.stopList.length&&(r+='<stop stop-color="rgb('+t.color.red+","+t.color.green+","+t.color.blue+')" offset="100%" stop-opacity="'+(1-t.opacity/100)+'"></stop>')}),r+=" </linearGradient>";var n=this._util.cacheFillSvg(r,"fill_",this.div);this.element.find(this.rootshapeJQueryId).css("fill","url("+n+")")}else if("solid"==s.typeValue||"white"==s.typeValue){var o=s.solidColor,a=$.Color(o.red,o.green,o.blue,1);this.fillColor=this._util.getColorHexString(a),this.element.find(this.rootshapeJQueryId).css("fill","rgb("+o.red+","+o.green+","+o.blue+")")}}else this.element.find(this.rootshapeJQueryId).css("fill","url(#sb4FillNone)");$(this.rootshapeJQueryId).css("stroke-width",this.lineWidth),$(this.rootshapeJQueryId).css("stroke",this.linecolor),$(this.rootshapeJQueryId).css("opacity",this._util.getOpacityByTransparency(this.transparency)),this.setTextStyleValue(this.div,-this.options.margin,-this.options.margin,this.options._w+this.getSizeOffset()+2*this.options.margin,this.options._h+this.getSizeOffset()+2*this.options.margin),this.textflow=$("<div>").appendTo(this.div),this.textflow.attr("class","notouch"),this.textflow.css("opacity",1-this.transparency/100),this.setTextStyleValue(this.textflow,this.options.margin+this.getPosOffset(),this.options.margin+this.getPosOffset(),this.options._w,this.options._h),this.replaceAttrValue(this.textflow,"overflow","hidden"),this.text=$("<div>").appendTo(this.textflow);var h=this.options._w-2*this.textPadding;h>0&&(this.drawText("shapetext",this.textValue,this.text,this.options.font,this.options.align,this.textColorValue,h,void 0,this.attr,void 0),this.text.attr("class","notouch"),this.setTextPosition(this.text.width(),this.text.height()))},getShadowBounds:function(){var t=1;void 0!=this.scaleValue&&(t=this.scaleValue/100);var e=this.options,i=this.options.margin-this.getSizeOffset(),s=this.shadowValue.size/100,r=4*this.shadowValue.radius,n=this.shadowValue.angle,o=this.shadowValue.distance,a=Math.cos(n*Math.PI/180)*o,h=Math.sin(n*Math.PI/180)*o,l=(e._w+2*i)*s+2*r,c=(e._h+2*i)*s+2*r,u=(e._w-l)/2,d=(e._h-c)/2,p=a+u,f=h+d;return[p*t,f*t,l*t,c*t]},setFillColor:function(t){t=this._util.parseColor(t),this.fillcolor=this._util.getColorHexString(t),this._firePaintRequest({fillcolor:this.fillcolor})},getFillColor:function(){return this.fillcolor?this.fillcolor:this._util.parseColor(this.element.find(this.rootshapeJQueryId).css("fill")).toHexString()},setLineColor:function(t){t=this._util.parseColor(t),this.linecolor=this._util.getColorHexString(t),this._firePaintRequest({linecolor:this.linecolor})},getLineColor:function(){return this.linecolor},setTextColor:function(t){t=this._util.parseColor(t),this.textColorValue=this._util.getColorHexString(t),this._firePaintRequest({textcolor:this.textColorValue})},getTextColor:function(){return this.textColorValue},setLineWeight:function(t){this.lineWidth=this._util.parseInt(t),this._firePaintRequest({linewidth:this.lineWidth})},getLineWeight:function(){return this.lineWidth},setText:function(t){this.textValue=this._util.parseString(t),this._firePaintRequest({text:this.textValue})},getText:function(){return this.getTextByVar(this.textValue)},highlight:function(t){var e=this.element.find(this.rootshapeJQueryId),i=this.element.find("#highlightshape");t?0==i.length&&(i=e.clone().appendTo(e.parent()),i.attr("id","highlightshape"),i.css("fill","orange"),i.css("opacity","0.4"),i.attr("class","notouch"),i.css("pointer-events","")):i.length>0&&i.remove()},refreshScale:function(t,e){if(t>0){t/=100;var i=this.getNormalPos(),s=(this.options._w+this.getSizeOffset())*t,r=(this.options._h+this.getSizeOffset())*t;this.element.css("left",i.left+"px"),this.element.css("top",i.top+"px"),this.element.css("width",s+"px"),this.element.css("height",r+"px"),this.scaleValue=100*t,this.setTextStyleValue(this.div,-this.options.margin*t,-this.options.margin*t,s+2*this.options.margin*t,r+2*this.options.margin*t),this.setTextStyleValue(this.textflow,(this.options.margin+this.getPosOffset())*t,(this.options.margin+this.getPosOffset())*t,this.options._w*t,this.options._h*t);var n,o,a=this.options._w*t-2*this.textPadding;if(a>0)if(this.textValue==this.options.text)this.drawText("shapetext",this.options.text,this.text,this.options.font,this.options.align,this.textColorValue,a,t,this.attr,void 0),n=this.text.width(),o=this.text.height(),this.setTextPosition(n,o);else{this.setTextStyleValue(this.text,0,0,a,r);var h=this.options.font.fontSize,l=h*t;this.options.font.fontSize=l,this.drawText("shapetext",this.textValue,this.text,this.options.font,this.options.align,this.textColorValue,-1*a),this.options.font.fontSize=h,n=this.text.width(),o=this.text.height(),this.setTextPosition(n,o),this.options.underline&&this.replaceAttrValue(this.text,"text-decoration","underline")}if(this.element.find(this.rootshapeJQueryId).attr("transform","translate("+this.getTranslateValue()*t+","+this.getTranslateValue()*t+") scale("+t+") "),void 0!=this.shadowValue&&"use"==this.shadowValue.shadow){this.shadowdiv.attr("style","position:absolute; text-align:center;");var c=this.getShadowBounds();this.setTextStyleValue(this.shadowdiv,c[1],c[0],c[2],c[3]),this.element.find("#"+this.rootshapeShadowId).attr("transform","scale("+t*this.shadowValue.size/100+") ")}}},getScale:function(){return this.scaleValue},setScale:function(t){t=this._util.parseNumber(t),t>0&&(this.oldscaleValue=this.scaleValue,this.scaleValue=t,this._firePaintRequest({scale:this.scaleValue}))},getTransparency:function(){return this.transparency},setTransparency:function(t){t=this._util.parseNumber(t),this._util.isValidTransparencyValue(t)&&(this.transparency=t,this._firePaintRequest({transparency:this.transparency}))},setAngle:function(t){t=this._util.parseNumber(t),t%=360,t!=this.angle&&(this.angle=t,this.addChangeState("angle",this.angle),this._firePaintRequest({angle:t}))},getAngle:function(){return this.angle},setTextStyleValue:function(t,e,i,s,r){var n="center";switch(this.options.align){case 0:n="left";break;case 1:n="center";break;case 2:n="right"}this.replaceAttrValue(t,"position","absolute"),this.removeAttrValue(t,"text-align"),null!=s&&this.replaceAttrValue(t,"width",s),null!=r&&this.replaceAttrValue(t,"height",r),null!=e&&this.replaceAttrValue(t,"top",e),null!=i&&this.replaceAttrValue(t,"left",i),this.replaceAttrValue(t,"text-align",n)},replaceAttrValue:function(t,e,i){if(!(t.length<1)){i=this._util.parseString(i);var s=t.attr("style");if(void 0==s&&(t.attr("style","position:absolute;"),s=t.attr("style")),-1==s.search(e+":absolute"))if(-1==s.search(e))s+="top"==e||"left"==e||"width"==e||"height"==e?e+":"+i+"px;":e+":"+i+";",t.attr("style",s);else{var r=s.substring(0,s.search(e)),n=s.substring(s.indexOf(";",s.search(e))+1,s.length+1);"top"==e||"left"==e||"width"==e||"height"==e?t.attr("style",r+e+":"+i+"px;"+n):t.attr("style",r+e+":"+i+";"+n)}}},removeAttrValue:function(t,e){var i=t.attr("style");if(!(t.length<1)&&(void 0==i&&(t.attr("style","position:absolute;"),i=t.attr("style")),-1!=i.search(e))){var s=i.substring(0,i.search(e)),r=i.substring(i.indexOf(";",i.search(e))+1,i.length+1);t.attr("style",s+r)}},getXAPIResult:function(){var t=this._super();return t.response=this.clkCnt+"",t},_paintWidgetShow:function(t){if(_.has(t,"text")&&(this.text.empty(),this.textValue=t.text,this.refreshScale(this.scaleValue)),_.has(t,"updateTextByVar")&&(this.text.empty(),this.refreshScale(this.scaleValue)),_.has(t,"fillcolor")&&(this.fillcolor=t.fillcolor,this.element.find(this.rootshapeJQueryId).css("fill",this.fillcolor)),_.has(t,"linecolor")&&(this.linecolor=t.linecolor,this.element.find(this.rootshapeJQueryId).css("stroke",this.linecolor)),_.has(t,"textcolor")&&(this.textColorValue=t.textcolor,this.refreshScale(this.scaleValue)),_.has(t,"linewidth")){this.lineWidth=t.linewidth,this.element.find(this.rootshapeJQueryId).css("stroke-width",this.lineWidth);var e=$(this.rootshapeJQueryId).find("rect");if(0!=e.length){var i=e.eq(0);0==this.lineWidth?(i.attr("width",this.options._w),i.attr("height",this.options._h)):(i.attr("width",this.options._w-1),i.attr("height",this.options._h-1))}this.refreshScale(this.scaleValue)}if(_.has(t,"scale")&&t.scale>0&&(this.scaleValue=t.scale,this.refreshScale(this.scaleValue)),_.has(t,"transparency")){this.transparency=t.transparency;var s=1-this.transparency/100;this.textflow.css("opacity",s),this.element.find(this.rootshapeJQueryId).css("opacity",s),this.element.find("#"+this.rootshapeId+"_shadow").css("opacity",s)}_.has(t,"angle")&&this.element.css("transform","rotate("+this.angle+"deg)"),this.currentBoundingWidth=this.element.get(0).getBoundingClientRect().width,this.currentBoundingHeight=this.element.get(0).getBoundingClientRect().height,this._super(t)},getFxElement:function(){return this.element},_refreshFxElement:function(){this.getFxElement().find("use").attr("xlink:href",this.getFxElement().find("use").attr("xlink:href"))},getNormalPos:function(){var t={};t.left=parseFloat($(this.element).css("left")),t.top=parseFloat($(this.element).css("top"));var e=this.scaleValue/100,i=this.oldscaleValue/100;if(this.scaleValue!=this.oldscaleValue){var s=i-e;t.left=t.left+s*(this.options._w/2+this.getPosOffset()),t.top=t.top+s*(this.options._h/2+this.getPosOffset())}return t},getPos:function(){var t=this._super();if(0==this.angle)t.left=Math.round(t.left+this.getPosOffset()),t.top=Math.round(t.top+this.getPosOffset());else{var e=this.scaleValue/100;t.left=Math.round(t.left-(this.currentBoundingWidth-this.currentWidth*e)/2)+this.getPosOffset(),t.top=Math.round(t.top-(this.currentBoundingHeight-this.currentHeight*e)/2)+this.getPosOffset()}return t},setPos:function(t){var e=this._util.parsePosition(t),i={};if(0==this.angle)i.left=Math.round(e[0]-this.getPosOffset()),i.top=Math.round(e[1]-this.getPosOffset());else{var s=this.scaleValue/100;i.left=Math.round(e[0]+(this.currentBoundingWidth-this.currentWidth*s)/2)-this.getPosOffset(),i.top=Math.round(e[1]+(this.currentBoundingHeight-this.currentHeight*s)/2)-this.getPosOffset()}this._super(i)},_init:function(){this._debug("init called");var t=this;this.element.find(this.rootshapeJQueryId).click(function(){void 0!=t.options.link&&""!=t.options.link&&t.handleLinkData(t.options.link),t.clkCnt++,t.fireEvent("onClick")}),this.element.find(this.rootshapeJQueryId).dblclick(function(){t.fireEvent("onDoubleClick")}),this.element.find(this.rootshapeJQueryId).mouseover(function(){t.fireEvent("onRollover")}),this.element.find(this.rootshapeJQueryId).mouseout(function(){t.fireEvent("onRollout")})},_getLimitPos:function(){var t=this.getFxElement(),e=t.children("div");if(null!=t&&0!=e.length){var i=[parseInt(e.css("left")),parseInt(e.css("top"))],s=this._util.getRotateSize([parseInt(e.css("width")),parseInt(e.css("height"))],this.getAngle()),r=Number(i[0]),n=Number(i[1]),o=Number(i[0]+s[0]),a=Number(i[1]+s[1]),h=[];h.push(r),h.push(n),h.push(o),h.push(a),h=this._getMaxBounds(h,e);var l=[];if(l.push(h[0]),l.push(h[1]),0!=this.angle){var c=parseInt($(this.element).css("width")),u=parseInt($(this.element).css("height")),d=this.getSize();l[0]=l[0]-(d[0]-c)/2,l[1]=l[1]-(d[1]-u)/2}return l}var l=[];return l.push(this.getPos().left),l.push(this.getPos().top),l},_getMaxBounds:function(t,e){var i=t[0],s=t[1],r=t[2],n=t[3],o=t;if(null!=e){if(0!=e.children("div").length)for(var a=e.children("div");null!=a&&a.is("div");)o=this._getMaxBounds(o,a),i=o[0],s=o[1],r=o[2],n=o[3],a=a.next();if(void 0!=e.css("left")&&void 0!=e.css("top")&&void 0!=e.css("width")&&void 0!=e.css("height")){var h=[parseInt(e.css("left")),parseInt(e.css("top"))],l=this._util.getRotateSize([parseInt(e.css("width")),parseInt(e.css("height"))],this.getAngle()),c=Number(h[0]),u=Number(h[1]),d=Number(h[0]+l[0]),p=Number(h[1]+l[1]);i=i>c?c:i,s=s>u?u:s,r=r>d?r:d,n=n>p?n:p}}var f=[];return f.push(i),f.push(s),f.push(r),f.push(n),f},_getRealBounds:function(){var t=this.getFxElement(),e=t.children("div");if(null!=t&&0!=e.length){var i=[parseInt(e.css("left")),parseInt(e.css("top"))],s=this._util.getRotateSize([parseInt(e.css("width")),parseInt(e.css("height"))],this.getAngle()),r=Number(i[0]),n=Number(i[1]),o=Number(i[0]+s[0]),a=Number(i[1]+s[1]),h=[];h.push(r),h.push(n),h.push(o),h.push(a),h=this._getMaxBounds(h,e);var l=this.getPos();if(0==this.angle)var c=Number(l.left)+h[0]-this.getPosOffset(),u=Number(l.top)+h[1]-this.getPosOffset();else var c=Number(l.left)+h[0],u=Number(l.top)+h[1];var d=h[2]-h[0],p=h[3]-h[1],f=[];return f.push(c),f.push(u),f.push(d),f.push(p),f}var f=[];return f.push(this.getPos().left),f.push(this.getPos().top),f.push(this.getSize()[0]),f.push(this.getSize()[1]),f},getPosOffset:function(){return Math.floor(this.lineWidth/2)},getSizeOffset:function(){return 2*this.getPosOffset()},getTranslateValue:function(){return this.options.margin+this.lineWidth/2},addChangeState:function(t,e){this.stateChangeMap[t]=e},setTextPosition:function(t,e){var i=this.textflow.width(),s=this.textflow.height(),r=(i-t)/2;switch(this.options.align){case 0:r=this.textPadding;break;case 2:r=i-this.textPadding-t}var n=0;n=e>s?0:0==this.textVerticalAlign?e+this.textPadding>s?s-e:this.textPadding:1==this.textVerticalAlign?(s-e)/2:e+this.textPadding>s?0:s-e-this.textPadding,this.text.css("position","absolute"),this.text.css("left",r),this.text.css("top",n)}}),a.getShortUIKey()}),define("wgt/com.smartbuilder.axon.widget.text.text/s",["module","underscore","sb4core/sbobj"],function(t,e,i){var s=t.config(),r=s.widgetsvc,n=r.getShortUIKey();return $.widget(r.getFullUIKey(),$.sb4[i],{options:{text:"",underline:!1,align:0,color:"#000000",link:void 0,font:{fontSize:24,fontFamily:"Arial",fontWeight:"",fontStyle:""},canvasheight:0,fixedheight:!1,canvaswidth:0,outborderweight:0,bordercolor:"#000000",bgcolor:"#000000",transparent:!1},_create:function(){var t=this.options;this.textMargin=5,this.element.addClass(n),this.element.attr("t"),this._super(),this.applyProfileFlag||(this.flag=!1,this.text=t.text,this.scale=1,this.attr={},this.attr.color=this._util.parseColor(t.color)),this.currentBoundingWidth=this.options.currentBoundingWidth,this.currentBoundingHeight=this.options.currentBoundingHeight,this.currentWidth=this.options._w,this.currentHeight=this.options._h;var i=parseInt(this.options._y+(this.currentBoundingHeight-this.currentHeight)/2),s=parseInt(this.options._x+(this.currentBoundingWidth-this.currentWidth)/2);if(this.angle=this.options.rotation,this.outborderweight=t.outborderweight,this.element.css({left:s-this.outborderweight+"px",top:i-this.outborderweight+"px"}),this.element.css("transform","rotate("+this.angle+"deg)"),this.h=t._h,this.w=t._w,this.attr.textAlign=1==t.align?"center":2==t.align?"right":"left",t.underline&&(this.attr.textDecoration="underline"),t.dir&&(this.attr.dir="rtl"),this.div=$('<div class="scroll-content">').appendTo(this.element),this.div.css("position","absolute"),this.div.css("overflow","hidden"),this.styleName=t.styleName,e.str.startsWith(this.styleName,"Heading")){var r=parseInt(this.styleName.substring("Heading".length));0/0!=r&&(this.div.attr("role","heading"),this.div.attr("aria-level",r+""))}if(1!=this.scale){var o=this.scale;this.h=o*t._h,this.w=o*t._w,this.element.css({left:s-(o*t._w-t._w)/2,top:i-(o*t._h-t._h)/2,width:o*t._w,height:o*t._h})}},setText:function(t){var e=this.options;this.flag=!0,t=this._util.parseString(t),this.text=t,this._firePaintRequest()},refreshText:function(){var t=this.options,e=this.element;if(t.fixedheight){this.div.css("width","auto");var i=this.div.get(0).offsetHeight;i>this.h?(this.element.css("overflow","hidden"),this.div.css("width",t._w-16-this.textMargin+"px"),this.div.css("overflow-x","hidden"),this.div.css("overflow-y","scroll"),this.div.data("height",i),this.div.css("height",this.options._h+"px"),null==this.scrollbar&&(this.scrollbar=document.createElement("div"),this.element.get(0).appendChild(this.scrollbar)),this.scrollbar.style.width="16px",this.scrollbar.style.height=this.h+"px",this.scrollbar.style.position="absolute",this.scrollbar.style.top="0px",this.scrollbar.style.left=this.w-16+"px",$(this.scrollbar).empty(),$(this.scrollbar).scrollbar(this.div.get(0)),this.div.removeClass("notouch")):(this.div.css("height","auto"),null!=this.scrollbar&&($(this.scrollbar).remove(),this.scrollbar=null))}else this.div.get(0).scrollHeight>this.div.get(0).clientHeight&&this.div.removeClass("notouch");t.outborderweight>0&&(e.css("border-width",t.outborderweight*this.scale),e.css("border-color",t.bordercolor),e.css("border-style","solid")),t.transparent&&e.css("background-color",t.bgcolor)},getText:function(){return this.getTextByVar(this.text)},getTextColor:function(){return this._util.parseColor(this.attr.color).toHexString(!1)},setTextColor:function(t){var e=this.options;t=this._util.parseColor(t),this.attr.color=t,this._firePaintRequest()},setScale:function(t){var e=this._util.parseNumber(t);e/=100,e>0&&(this.scale=e,this._firePaintRequest({scale:e}))},appendText:function(t){var e=this.options;t=this._util.parseString(t),this.text=this.text+t,this.flag=!0,this._firePaintRequest()},appendTextOnNewLine:function(t){var e=this.options;t=this._util.parseString(t),this.text=this.text+"\n"+t,this.flag=!0,this._firePaintRequest()},isBlank:function(t){return!t||""===$.trim(t)},getPos:function(){var t=this._super();return t.left=Math.round(t.left+this.outborderweight*this.scale),t.top=Math.round(t.top+this.outborderweight*this.scale),t},setPos:function(t){t=this._util.parsePosition(t);var e={};e.left=t[0]-this.outborderweight*this.scale,e.top=t[1]-this.outborderweight*this.scale,this._super(e)},arrayRemove:function(t,e){var i=[];if(isNaN(e)||e>t.length)return!1;for(var s=0;s<t.length;s++)t[s]!=t[e]&&i.push(t[s]);return i},_init:function(){this._super()},_paintWidgetShow:function(t){var i=this.options;if(e.has(t,"scale")){var s=this.scale,r=parseFloat($(this.element).css("left")),n=parseFloat($(this.element).css("top")),o=parseFloat($(this.element).css("width")),a=parseFloat($(this.element).css("height")),h=this._util.parseNumber($(this.element).css("border-width").replace("px"));this.h=s*i._h,this.w=s*i._w,this.element.css({left:r-(this.w-o)/2-(this.outborderweight*s-h),top:n-(this.h-a)/2-(this.outborderweight*s-h),width:this.w,height:this.h})}this.flag?(1==this.scale?this.drawText("",this.text,this.div,i.font,null,this.attr.color,-this.options.canvaswidth,this.scale,this.attr,i.link):this.drawText("",this.text,this.div,i.font,null,this.attr.color,-this.w,this.scale,this.attr,i.link),i.dir&&this.div.attr("dir","rtl")):(1==this.scale?this.drawText("",this.text,this.div,i.font,null,this.attr.color,this.options.canvaswidth,this.scale,this.attr,i.link):this.drawText("",this.text,this.div,i.font,null,this.attr.color,this.w,this.scale,this.attr,i.link),i.dir&&this.div.attr("dir","rtl")),this.refreshText(),this.setScreenReaderElement(this.getTabElementMap()),this.div.hasClass("notouch")&&!this.scrollbar?0==this.getDraggable()&&this.element.addClass("notouch"):this.element.removeClass("notouch"),this._super(t)},getTabElementMap:function(){var t={};return t.texts=this.getTabElementLabel(),t.tabElements=this.createTabElement(),t},getTabElementLabel:function(){var t=[];return t.push(this.getText()),t},createTabElement:function(){var t=this.options,e=this,i=[];if(t.link){this.div.attr("aria-hidden",!0);var s=this.getScreenReaderTabElement();if(s){var r=s[0];return r.css("width",this.div.css("width")),r.css("height",this.div.css("height")),s}this.tabDiv?this.tabDiv.empty():(this.tabDiv=$("<div>").appendTo(this.element),this.tabDiv.addClass("notouch"));var r=$("<a>").appendTo(this.tabDiv);r.css("display","block"),r.css("width",this.div.css("width")),r.css("height",this.div.css("height")),r.attr("href",t.link.link),r.click(function(){event.preventDefault(),SB4API.linkLib.handleLinkData(e,t.link)}),i.push(r)}return i},doSetFocus:function(t){var e=this,i=this.options;i.showFocusRing||$(t).addClass("sb4-not-focus"),i.link?this._super(t):(t=$(t),1==SB4API.tabOrder?(this._util.calculateTabindex(),t.attr("tabindex",this.getTabIndex())):t.attr("tabindex","0"),t.one("blur",function(){t.removeAttr("tabindex"),t.off("blur"),e.div.children("canvas").length>=1&&t.remove()}),t.focus())},focus:function(){var t=this.options;if(t.link){var e=this.getScreenReaderTabElement();if(e&&0!=e.length){var i=e[0];this.doSetFocus(i)}}else if(this.div.children("canvas").length>=1){var s=$("<div>");s.text(this.text),s.css("width",this.div.css("width")),s.css("height",this.div.css("height")),s.css("color","rgba(255,255,255,0)"),s.appendTo(this.element),s.css("position","absolute"),s.addClass("notouch"),this.doSetFocus(s)}else this.doSetFocus(this.div)},setAccessibilityHidden:function(t){this.element.attr("aria-hidden",t);var e=this.getScreenReaderTabElement();if(e&&0!=e.length)for(var i=0;i<e.length;i++){var s=e[i];s.attr("aria-hidden",t)}},_destroy:function(t){this._super(t),this.scrollbar=null},getAngle:function(){return this.angle},getFxElement:function(){return this.element},_getLimitPos:function(){var t=this.getFxElement(),e=this._getRealBounds(),i=[];return i.push(e[0]-parseInt(t.css("left"))),i.push(e[1]-parseInt(t.css("top"))),i},_getRealBounds:function(){var t=this.getFxElement(),e=[];return e.push(parseInt(t.css("left"))),e.push(parseInt(t.css("top"))),e.push(parseInt(t.css("width"))+this.outborderweight*this.scale*2),e.push(parseInt(t.css("height"))+this.outborderweight*this.scale*2),this._util.getRotateRect(e,this.getAngle())}}),r.getShortUIKey()}),define("lib/css!widgets/com.smartbuilder.axon.widget.text.richtext/style",[],function(){}),define("wgt/com.smartbuilder.axon.widget.text.richtext/s",["module","underscore","sb4core/sbobj","css!widgets/com.smartbuilder.axon.widget.text.richtext/style.css"],function(t,e,i){var s=t.config(),r=s.widgetsvc,n=r.getShortUIKey();return $.widget(r.getFullUIKey(),$.sb4[i],{options:{html:"",canvasheight:0,fixedheight:!1,canvaswidth:0,outborderweight:0,bordercolor:"#000000",bgcolor:"#000000",transparent:!1},_create:function(){var t=this.options;this.element.addClass(n),this._super(),this.applyProfileFlag||(this.formathtml=t.html,this.attr={},this.flag=null),this.outborderweight=t.outborderweight,this.element.css({left:t._x-this.outborderweight+"px",top:t._y-this.outborderweight+"px"});var i='<div style="position:absolute">'+this.formathtml+"</div>";this.text="";try{var s=$(i),r=s.find("a");e.each(r,function(t,e){var i=$(t).children();if(1==i.length){var s=i.eq(0),r=s.css("color");r&&$(t).css("color",r)}}),this.text=s.text(),this.formathtml=s.html();var o=this.getFirstTextNode(s.get(0));this.getFirstTextStyle(s.get(0),o,this.attr)}catch(a){}if(this.div=$('<div  class="scroll-content">').appendTo(this.element),this.div.css("position","absolute"),this.div.css("word-wrap","break-word"),this.styleName=t.styleName,e.str.startsWith(this.styleName,"Heading")){var h=parseInt(this.styleName.substring("Heading".length));0/0!=h&&(this.div.attr("role","heading"),this.div.attr("aria-level",h+""))}},createNewHtml:function(t,e,i){var s=null;if(e!=t){s=this.createNewHtml(t,e.parentNode,i);var r=e.cloneNode(!1);s.appendChild(r),s=r}else s=i;return s},deleteStyle:function(t){var e=this;t.css("color",""),t.children().each(function(){var t=$(this);e.deleteStyle(t)})},delColorStyle:function(t){if(t.hasChildNodes())for(var e=t.childNodes,i=0;i<e.length;i++){var s=e[i];1==s.nodeType&&($(s).css("color",""),this.delColorStyle(s))}},setText:function(t){var i=this.options;this.flag="text",t=this._util.parseString(t),this.text=t;var s=$("<p>");void 0!=this.attr&&e.each(this.attr,function(t,e){s.css(e,t)}),s.text(t),this.formathtml=s.get(0).outerHTML,this._firePaintRequest()},refreshText:function(){var t=this.options,e=this.element;if(t.fixedheight){this.div.css("height","");var i=this.div.get(0).offsetHeight;i>t._h?(this.element.css("overflow","hidden"),this.div.css("overflow-x","hidden"),this.div.css("overflow-y","scroll"),this.div.data("height",i),this.div.css("height",this.options._h+"px"),null==this.scrollbar?(this.div.css("width",t._w-16-t.scrollerMargin+"px"),this.scrollbar=document.createElement("div"),this.scrollbar.style.width="16px",this.scrollbar.style.height=t._h+"px",this.scrollbar.style.position="absolute",this.scrollbar.style.top="0px",this.scrollbar.style.left=t._w-16+"px",this.element.get(0).appendChild(this.scrollbar)):this.div.css("width",t._w-16-t.scrollerMargin+"px"),$(this.scrollbar).empty(),$(this.scrollbar).scrollbar(this.div.get(0)),this.div.removeClass("notouch")):(this.div.css("height","auto"),null!=this.scrollbar&&($(this.scrollbar).remove(),this.scrollbar=null))}else 0!=this.div.height()&&(e=this.div),this.div.get(0).scrollHeight>this.div.get(0).clientHeight&&this.div.removeClass("notouch");t.outborderweight>0&&(e.css("border-width",t.outborderweight),e.css("border-color",t.bordercolor),e.css("border-style","solid")),t.transparent&&e.css("background-color",t.bgcolor)},getText:function(){return this.getTextByVar(this.text)},setTextColor:function(t){var e=this.options;if(null==this.flag&&(this.flag="color"),t=this._util.parseColor(t),this.attr.color=t,""!=this.div.html()){this.deleteStyle(this.div);for(var i=this.div.children().length,s=0;i>s;s++){var r=this.div.children().eq(s);"hr"!=r.prop("tagName").toLowerCase()&&r.css("color",t)}this.formathtml=this.div.html()}else{var n=$("<div>"+this.formathtml+"</div>");this.deleteStyle(n);for(var i=n.children().length,s=0;i>s;s++){var r=n.children().eq(s);"hr"!=r.prop("tagName").toLowerCase()&&r.css("color",t)}this.formathtml=n.html(),n.remove()}this._firePaintRequest()},appendTextOnNewLine:function(t){t=this._util.parseString(t),this.flag="append";var i=$("<p>");void 0!=this.attr&&e.each(this.attr,function(t,e){i.css(e,t)}),null==t||""==t?i.append("&nbsp;"):i.text(t);var s=$("<div>");this.formathtml=this.formathtml+"\n"+i.get(0).outerHTML,s.html(this.formathtml),this.text=s.text(),this._firePaintRequest()},setFormattedText:function(t){this.flag="format",t=this._util.parseString(t),this.formathtml=t;var i=$("<p>");void 0!=this.attr&&e.each(this.attr,function(t,e){i.css(e,t)}),i.html(t),this.text=i.text(),this._firePaintRequest()},getFirstTextStyle:function(t,e,i){if(e!=t){this.getFirstTextStyle(t,e.parentNode,i);var s=e.getAttribute("style"),r=e.getAttribute("dir");this.getFontStyle(s,i,r)}else{var s=t.getAttribute("style"),r=e.getAttribute("dir");this.getFontStyle(s,i,r),void 0==i.fontSize&&(i.fontSize="16px"),void 0==i.fontFamily&&(i.fontFamily="Arial"),void 0==i.color&&(i.color="#000000"),void 0==i.bgcolor&&(i.bgcolor="#ffffff")}},getFirstTextNode:function(t){var e=null;if(t.hasChildNodes())for(var i=t.childNodes,s=0;s<i.length;s++)if(3!=i[s].nodeType){if(e=this.getFirstTextNode(i[s]),null!=e)break}else{var r=i[s].nodeValue;if(!this.isBlank(r)){e=t;break}}return e},isBlank:function(t){return!t||""===$.trim(t)},scroll:function(t,e){if(null==this.scrollbar);else{var i=$(this.scrollbar).data("hiddenParth"),s=$(this.scrollbar).data("canDragH");e=Math.abs(this._util.parseInt(e));var r=-this.div.get(0).scrollTop;"up"===t?-e>r?r+=e:r=0:r>-i+e?r-=e:r=-i,this.div.get(0).scrollTop=Math.abs(r)}},canScroll:function(t){if(null==this.scrollbar)return!1;var e=this.div.css("top");if(e=parseInt(e.substring(0,e.length-2)),"up"===t)return 0!=e;var i=$(this.scrollbar).data("hiddenParth");return e!=-i},arrayRemove:function(t,e){var i=[];if(isNaN(e)||e>t.length)return!1;for(var s=0;s<t.length;s++)t[s]!=t[e]&&i.push(t[s]);return i},getPos:function(){var t=this._super();return t.left=t.left+this.outborderweight,t.top=t.top+this.outborderweight,t
},setPos:function(t){t=this._util.parsePosition(t);var e={};e.left=t[0]-this.outborderweight,e.top=t[1]-this.outborderweight,this._super(e)},getFontStyle:function(t,e,i){if(null!=t)for(var s=t.split(";"),r=0;r<s.length;r++){var n=s[r].split(":");"font-size"==n[0].trim()?e.fontSize=n[1].trim():"color"==n[0].trim()?e.color=n[1].trim():"font-weight"==n[0].trim()?e.fontWeight=n[1].trim():"font-style"==n[0].trim()?e.fontStyle=n[1].trim():"font-family"==n[0].trim()?e.fontFamily=n[1].trim():"margin-left"==n[0].trim()?e.marginLeft=n[1].trim():"margin-right"==n[0].trim()?e.marginRight=n[1].trim():"text-align"==n[0].trim()?e.textAlign=n[1].trim():"background-color"==n[0].trim()?e.bgcolor=n[1].trim():"text-decoration"==n[0].trim()?e.underline=n[1].trim():"isli"==n[0].trim()&&(e.isli=n[1].trim())}null!=i&&(e.dir=i)},_init:function(){this._debug("init called")},_paintWidgetShow:function(t){null==this.flag?this.drawRichText("",this.formathtml,this.div,null,this.options.canvaswidth):"color"==this.flag?this.drawRichText("",this.formathtml,this.div,null,this.options.canvaswidth,this.attr):"format"==this.flag?this.drawRichText("",this.formathtml,this.div,null,-this.options.canvaswidth,this.attr):"append"==this.flag?this.drawRichText("",this.formathtml,this.div,null,-this.options.canvaswidth,this.attr):this.drawText("",this.text,this.div,null,null,null,-this.options.canvaswidth,null,this.attr),this.refreshText(),this.setScreenReaderElement(this.getTabElementMap()),this.div.hasClass("notouch")&&!this.scrollbar?0==this.getDraggable()&&this.element.addClass("notouch"):this.element.removeClass("notouch"),this._super(t)},getTabElementMap:function(){var t={};return t.texts=this.getTabElementLabel(),t.tabElements=this.createTabElement(),t},getTabElementLabel:function(){var t=[],e='<div style="position:absolute">'+this.formathtml+"</div>";try{var i=$(e),s=$("a",i),r=$("a",this.element);if(r.length>0)return t;if(s.length>0)for(var n=0;n<s.length;n++)t.push(this.getTextByVar(s.eq(n).text()))}catch(o){}return t},createTabElement:function(){var t=this.options,i=this,s=[],r='<div style="position:absolute">'+this.formathtml+"</div>";try{var n=$(r),o=$("a",n),a=$("a",this.element);if(a.length>0)for(var h=0;h<a.length;h++){var l=a.eq(h);s.push(l)}else if(o.length>0)for(var h=0;h<o.length;h++){var l=o.eq(h);l.text(""),l.css("display","block"),l.css("width",this.div.css("width")),l.css("height",this.div.css("height"));var c=l.attr("href");e.string.startsWith(c,"evt://")&&(l.removeAttr("onclick"),l.click(function(t){t.preventDefault();var i=$(this).attr("href");if(i){var s=i.split("::");if(void 0!=s[2]&&""!=s[2]){var r=s[2].split(",");void 0==s[0]&&(s[0]=""),void 0==s[1]&&(s[1]=""),s[1]=e.string.trim(r[0]," '");var n=r.splice(1);s[2]=e.string.trim(n.join()," '")}SB4API.linkLib.openHyperLink(wgt,s[0],s[1],s[2])}})),s.push(l),l.appendTo(this.tabDiv)}}catch(u){}return s},doSetFocus:function(t){var e=this,i=this.options;i.showFocusRing||$(t).addClass("sb4-not-focus"),t=$(t),1==SB4API.tabOrder?(this._util.calculateTabindex(),t.attr("tabindex",this.getTabIndex())):t.attr("tabindex","0"),t.one("blur",function(){t.removeAttr("tabindex"),t.off("blur"),t.remove()}),t.focus()},focus:function(){var t=$("<div>");t.text(this.text),t.css("color","rgba(255,255,255,0)"),t.css("width",this.div.css("width")),t.css("height",this.div.css("height")),t.css("position","absolute"),t.addClass("notouch"),this.element.append(t),this.doSetFocus(t)},setAccessibilityHidden:function(t){this.element.attr("aria-hidden",t);var e=this.getScreenReaderTabElement();if(e&&0!=e.length)for(var i=0;i<e.length;i++){var s=e[i];s.attr("aria-hidden",t)}},_destroy:function(t){this._super(t),this.scrollbar=null}}),r.getShortUIKey()}),define("text!widgets/com.smartbuilder.axon.widget.image/tpl.html",[],function(){return'<img alt="" src="<%- rc.img %>" />'}),define("text!widgets/com.smartbuilder.axon.widget.image/texttpl.html",[],function(){return'<div style="position:absolute;"><%- rc.text %></div>'}),define("lib/css!widgets/com.smartbuilder.axon.widget.image/style",[],function(){}),define("util/jquery-timer",["jquery"],function(jQuery){$.timer=function(func,time,autostart){return this.set=function(func,time,autostart){if(this.init=!0,"object"==typeof func){var paramList=["autostart","time"];for(var arg in paramList)void 0!=func[paramList[arg]]&&eval(paramList[arg]+" = func[paramList[arg]]");func=func.action}return"function"==typeof func&&(this.action=func),isNaN(time)||(this.intervalTime=time),autostart&&!this.active&&(this.active=!0,this.setTimer()),this},this.once=function(t){var e=this;return isNaN(t)&&(t=0),window.setTimeout(function(){e.action()},t),this},this.play=function(t){return this.active||(t?this.setTimer():this.setTimer(this.remaining),this.active=!0),this},this.pause=function(){return this.active&&(this.active=!1,this.remaining-=new Date-this.last,this.clearTimer()),this},this.stop=function(){return this.active=!1,this.remaining=this.intervalTime,this.clearTimer(),this},this.toggle=function(t){return this.active?this.pause():t?this.play(!0):this.play(),this},this.reset=function(){return this.active=!1,this.play(!0),this},this.clearTimer=function(){window.clearTimeout(this.timeoutObject)},this.setTimer=function(t){var e=this;"function"==typeof this.action&&(isNaN(t)&&(t=this.intervalTime),this.remaining=t,this.last=new Date,this.clearTimer(),this.timeoutObject=window.setTimeout(function(){e.go()},t))},this.go=function(){this.active&&(this.action(),this.setTimer())},this.init?new $.timer(func,time,autostart):(this.set(func,time,autostart),this)}}),define("wgt/com.smartbuilder.axon.widget.image/s",["module","sb4core/sbobj","text!widgets/com.smartbuilder.axon.widget.image/tpl.html","text!widgets/com.smartbuilder.axon.widget.image/texttpl.html","css!widgets/com.smartbuilder.axon.widget.image/style.css","util/jquery-timer"],function(t,e,i,s,r,r){var n=t.config(),o=n.widgetsvc,a=o.getShortUIKey();return $.widget(o.getFullUIKey(),$.sb4[e],{options:{textwidth:0,textheight:0,borderweight:0,outborderweight:0,bordercolor:"",captiontext:"",link:"",captionfont:{fontSize:16,fontFamily:"Arial",fontWeight:"",fontStyle:""},captionlocation:2,source:"",transparency:50,preload:!1,imagewidth:0,imageheight:0,shadowoffsetx:0,shadowoffsety:0,shadowradius:0,shadowsize:0,shadowalpha:0,shadowcolor:"#000000",hasshadow:!1,description:"",rotation:0},_create:function(){null==this.stateChangeMap&&(this.stateChangeMap={}),this.captiontextwidth=-1,this.element.addClass(a),this._super();var t=this.options;this.applyProfileFlag||(this.scale=1,this.oldscaleValue=this.scale),this.imageLoad=!1,this.currentBoundingWidth=t.currentBoundingWidth,this.currentBoundingHeight=t.currentBoundingHeight,this.currentWidth=t._w,this.currentHeight=t._h,this.top=parseInt(this.options._y+this.currentBoundingHeight/2-this.currentHeight/2),this.left=parseInt(this.options._x+this.currentBoundingWidth/2-this.currentWidth/2),_.has(this.stateChangeMap,"angle")||(this.angle=this.options.rotation),_.has(this.stateChangeMap,"outborderweight")||(this.outborderweight=t.outborderweight),_.has(this.stateChangeMap,"transparency")||(this.transparency=t.transparency),_.has(this.stateChangeMap,"captiontext")||(this.captiontext=t.captiontext),_.has(this.stateChangeMap,"bordercolor")||(this.bordercolor=this._util.parseColor(t.bordercolor)),this.borderweight=t.borderweight,this._createContent()},id:[0],_createShadow:function(){try{var t=this.options,e=t.imagewidth,i=t.imageheight,s=e*t.shadowsize/100,r=i*t.shadowsize/100,n=e*t.shadowsize/100+8*t.shadowradius,o=i*t.shadowsize/100+8*t.shadowradius;this._shadowdiv.css({width:n*this.scale,height:o*this.scale});var a=document.createElementNS("http://www.w3.org/2000/svg","svg");a.setAttribute("aria-hidden","true"),a.setAttribute("focusable","false"),a.setAttribute("width",n*this.scale),a.setAttribute("height",o*this.scale),a.style.postion="absolute",a.style.top=0,a.style.left=0,this._shadowdiv.get(0).appendChild(a);var h=document.createElementNS("http://www.w3.org/2000/svg","defs");a.appendChild(h);var l=document.createElementNS("http://www.w3.org/2000/svg","filter");l.setAttribute("id",this.id[0]),l.setAttribute("x","0"),l.setAttribute("y","0");var c=n/e,u=o/i;l.setAttribute("width",100*c+"%"),l.setAttribute("height",100*u+"%"),h.appendChild(l);var d=document.createElementNS("http://www.w3.org/2000/svg","feOffset");d.setAttribute("result","offOut"),d.setAttribute("in","SourceGraphic"),d.setAttribute("dx",4*t.shadowradius),d.setAttribute("dy",4*t.shadowradius),l.appendChild(d);var p=document.createElementNS("http://www.w3.org/2000/svg","feGaussianBlur");p.setAttribute("result","blurOut"),p.setAttribute("in","offOut"),p.setAttribute("stdDeviation",t.shadowradius),l.appendChild(p);var f=document.createElementNS("http://www.w3.org/2000/svg","rect");f.setAttribute("width",s),f.setAttribute("height",r),f.setAttribute("fill",t.shadowcolor),f.setAttribute("fill-opacity",(100-t.shadowalpha)/100),f.setAttribute("filter","url(#"+this.id[0]+")"),f.setAttribute("transform","scale("+this.scale+")"),a.appendChild(f),this.id[0]++}catch(g){}},getShadowLocation:function(){var t=this.options,e=t.imagewidth,i=t.imageheight,s=e*t.shadowsize/100+8*t.shadowradius,r=i*t.shadowsize/100+8*t.shadowradius,n=(e-s)/2,o=(i-r)/2,a=t.shadowoffsetx+n,h=t.shadowoffsety+o;return[a*this.scale,h*this.scale]},_createContent:function(){this.element.empty();var t=this,e=this.options;this.rotationdiv=$("<div>").appendTo(this.element),this.rotationdiv.css("position","absolute");var s=(e.imagewidth+2*this.outborderweight)*this.scale,n=(e.imageheight+2*this.outborderweight)*this.scale;this.rotationdiv.css({top:-this.outborderweight*this.scale,left:-this.outborderweight*this.scale,width:s,height:n}),this.element.css("transform","rotate("+this.angle+"deg)"),_.templateSettings.variable="rc";var a=_.template(i),h={img:o.getWidgetAssetURI(e.source)};e.hasshadow&&(this._shadowdiv=$("<div>").appendTo(this.rotationdiv),this._shadowdiv.css("position","absolute")),this._borderdiv=$("<div>").appendTo(this.rotationdiv),this._borderdiv.css("position","absolute"),this._borderdiv.attr("aria-hidden","true"),this._inslideborderdiv=$("<div>").appendTo(this.rotationdiv),this._inslideborderdiv.css("position","absolute"),this.element.css({width:e._w*this.scale,height:e._h*this.scale,left:this.left-(e._w*this.scale-e._w)/2,top:this.top-(e._h*this.scale-e._h)/2}),""!=this.captiontext&&(this._textbox=$("<div>").appendTo(this.element),this._textbox.css("position","absolute"),this.drawText("",this.captiontext,this._textbox,e.captionfont,0,"#000000",this.captiontextwidth,this.scale),this._textbox.css("transform","rotate(-"+this.angle+"deg)")),""!=e.description&&(this._descbox=$("<div>").appendTo(this.element),this._descbox.addClass("notouch"),this._descbox.addClass("sr-only"),this._descbox.text(e.description));var l=a(h);this.img=$(l).get(0),this.img.onload=function(){t._borderdiv.text(""),t._borderdiv.css("text-align",""),t._borderdiv.css("line-height",""),t._borderdiv.css("background-color","");var i;1==e.flip?i="scaleX(-1)":2==e.flip?i="scaleY(-1)":3==e.flip&&(i="scale(-1, -1)"),i&&$(t.img).css("transform",i),$(t.img).appendTo(t._borderdiv),e.hasshadow&&t._createShadow();var s={x1:0,x2:1,y1:0,y2:1};e.crop&&(s=JSON.parse(e.crop)),t.normalWidth=parseInt(Math.round(e.imagewidth/(s.x2-s.x1))),t.normalHeight=parseInt(Math.round(e.imageheight/(s.y2-s.y1))),1==e.flip?(t.normalLeft=parseInt(Math.round(t.normalWidth*(1-s.x2))),t.normalTop=parseInt(Math.round(t.normalHeight*s.y1))):2==e.flip?(t.normalLeft=parseInt(Math.round(t.normalWidth*s.x1)),t.normalTop=parseInt(Math.round(t.normalHeight*(1-s.y2)))):3==e.flip?(t.normalLeft=parseInt(Math.round(t.normalWidth*(1-s.x2))),t.normalTop=parseInt(Math.round(t.normalHeight*(1-s.y2)))):(t.normalLeft=parseInt(Math.round(t.normalWidth*s.x1)),t.normalTop=parseInt(Math.round(t.normalHeight*s.y1))),$(t.img).attr("width",t.normalWidth*t.scale),$(t.img).attr("height",t.normalHeight*t.scale),$(t.img).css("position","absolute"),$(t.img).css("top",0-t.normalTop),$(t.img).css("left",0-t.normalLeft),t.options.hand&&$(t.img).css("cursor","pointer"),t.imageLoad=!0},this._borderdiv.text(e.description),this._borderdiv.css("overflow","hidden"),this._borderdiv.css("text-align","center");var c=e.imagewidth*this.scale,u=e.imageheight*this.scale,d=e.imagewidth*this.scale,p=e.imageheight*this.scale,f=(e.imagewidth-2*this.borderweight)*this.scale,g=(e.imageheight-2*this.borderweight)*this.scale;t._borderdiv.css({width:d,height:p}),t._borderdiv.css("line-height",p+"px"),t._inslideborderdiv.css({width:f,height:g}),0!=this.outborderweight&&(t._borderdiv.css("border-width",this.outborderweight*this.scale+"px"),t._borderdiv.css("border-color",this.bordercolor),t._borderdiv.css("border-style","solid")),0!=this.borderweight&&(t._inslideborderdiv.css("border-width",this.borderweight*this.scale+"px"),t._inslideborderdiv.css("border-color",this.bordercolor),t._inslideborderdiv.css("border-style","solid"));var v=[0,0];""!=this.captiontext&&(0==this.captiontextwidth?(v[0]=e.textwidth*this.scale,v[1]=e.textheight*this.scale):(v=t.measureText(this.getCaptionText(),e.captionfont.fontWeight,e.captionfont.fontFamily,e.captionfont.fontSize),v[0]=v[0]*this.scale,v[1]=v[1]*this.scale,t._textbox.css("overflow","visible"),t._textbox.css("white-space","nowrap"))),this.shadowx=0;var m=0,b=0;this.shadowy=0;var x=0,y=0,w=(e.shadowoffsetx-2*e.shadowradius)*this.scale,S=(e.shadowoffsety-2*e.shadowradius)*this.scale,T=this.getShadowLocation();if(this.shadowx=T[0],this.shadowy=T[1],null!=this._textbox){var I=this.element.get(0).getBoundingClientRect().top,m=0,x=0;if(m=this.outborderweight*this.scale+(c-v[0])/2,x=1==e.captionlocation?this.outborderweight*this.scale+(u-v[1])/2:0==e.captionlocation?this.outborderweight*this.scale-v[1]+(this._inslideborderdiv.get(0).getBoundingClientRect().top-I):this.outborderweight*this.scale+this._inslideborderdiv.get(0).getBoundingClientRect().bottom-I,0!=this.angle){(0==e.captionlocation||2==e.captionlocation)&&(x-=(this.rotationdiv.get(0).getBoundingClientRect().height-(u+2*this.outborderweight*this.scale))/2);var B=this._util.getRotatePoint([c/2,u/2],[m+v[0]/2,x+v[1]/2],360-this.angle);m=B[0]-v[0]/2,x=B[1]-v[1]/2,this._textbox.css("transform","rotate(-"+this.angle+"deg)")}this._textbox.css("top",x+"px"),this._textbox.css("left",m+"px")}this.shadowx=this.shadowx+this.outborderweight*this.scale,this.shadowy=this.shadowy+this.outborderweight*this.scale,t._borderdiv.css("top","0px"),t._borderdiv.css("left","0px"),t._inslideborderdiv.css("top",this.borderweight*this.scale+"px"),t._inslideborderdiv.css("left",this.borderweight*this.scale+"px"),e.hasshadow&&(t._shadowdiv.css("top",this.shadowy+"px"),t._shadowdiv.css("left",this.shadowx+"px")),this._inslideborderdiv.addClass("notouch"),this.element.css("opacity",(100-this.transparency)/100),this._borderdiv.mouseover($.proxy(function(){this.fireEvent("onRollover")},this)),this._borderdiv.mouseout($.proxy(function(){this.fireEvent("onRollout")},this)),this._borderdiv.click($.proxy(function(){this.fireEvent("onClick"),this.options.link!=r&&""!=this.options.link&&this.handleLinkData(this.options.link)},this)),this._borderdiv.dblclick($.proxy(function(){this.fireEvent("onDoubleClick")},this)),this.setScreenReaderElement(this.getTabElementMap())},_init:function(){this._debug("init called")},_changeContent:function(t){var e=this,i=this.options,s=(i.imagewidth+2*this.outborderweight)*this.scale,r=(i.imageheight+2*this.outborderweight)*this.scale;this.rotationdiv.css({top:-this.outborderweight*this.scale,left:-this.outborderweight*this.scale,width:s,height:r});var n=i.imagewidth*this.scale,o=i.imageheight*this.scale;if(this._inslideborderdiv.css({top:this.borderweight*this.scale,left:this.borderweight*this.scale,width:(i.imagewidth-2*this.borderweight)*this.scale,height:(i.imageheight-2*this.borderweight)*this.scale}),0!=this.borderweight?(this._inslideborderdiv.css("border-width",this.borderweight*this.scale+"px"),this._inslideborderdiv.css("border-color",this.bordercolor),this._inslideborderdiv.css("border-style","solid")):this._inslideborderdiv.css("border",""),this._borderdiv.css({top:0,left:0,width:n,height:o}),this._borderdiv.css("line-height",o+"px"),0!=this.outborderweight?(this._borderdiv.css("border-width",this.outborderweight*this.scale+"px"),this._borderdiv.css("border-color",this.bordercolor),this._borderdiv.css("border-style","solid")):this._borderdiv.css("border",""),null!=this._textbox&&this._textbox.remove(),this.imageLoad&&(i.hasshadow&&(this._shadowdiv.empty(),this._createShadow(),this._shadowdiv.css("top",this.shadowy*this.scale+"px"),this._shadowdiv.css("left",this.shadowx*this.scale+"px")),$(this.img).attr("width",e.normalWidth*e.scale),$(this.img).attr("height",e.normalHeight*e.scale),$(this.img).css("top",0-e.normalTop),$(this.img).css("left",0-e.normalLeft)),t){var a=this.getNormalPos();this.element.css({width:i._w*this.scale,height:i._h*this.scale,left:a.left+"px",top:a.top+"px"})}if(""!=this.captiontext){var h=i.imagewidth*this.scale,l=i.imageheight*this.scale;this._textbox=$("<div>").appendTo(this.element),this._textbox.css("position","absolute"),this.drawText("",this.captiontext,this._textbox,i.captionfont,0,"#000000",this.captiontextwidth,this.scale);var c=[0,0];0==this.captiontextwidth?(c[0]=i.textwidth*this.scale,c[1]=i.textheight*this.scale):(c=this.measureText(this.getCaptionText(),i.captionfont.fontWeight,i.captionfont.fontFamily,i.captionfont.fontSize),c[0]=c[0]*this.scale,c[1]=c[1]*this.scale,this._textbox.css("overflow","visible"),this._textbox.css("white-space","nowrap"));var u=this.element.get(0).getBoundingClientRect().top,d=0,p=0;if(d=this.outborderweight*this.scale+(h-c[0])/2,p=1==i.captionlocation?this.outborderweight*this.scale+(l-c[1])/2:0==i.captionlocation?this.outborderweight*this.scale-c[1]+(this._inslideborderdiv.get(0).getBoundingClientRect().top-u):this.outborderweight*this.scale+this._inslideborderdiv.get(0).getBoundingClientRect().bottom-u,0!=this.angle){(0==i.captionlocation||2==i.captionlocation)&&(p-=(this.rotationdiv.get(0).getBoundingClientRect().height-(l+2*this.outborderweight*this.scale))/2);var f=this._util.getRotatePoint([h/2,l/2],[d+c[0]/2,p+c[1]/2],360-this.angle);d=f[0]-c[0]/2,p=f[1]-c[1]/2,this._textbox.css("transform","rotate(-"+this.angle+"deg)")}this._textbox.css("top",p+"px"),this._textbox.css("left",d+"px")}},setTransparency:function(t){var e=this.options,i=this._util.parseInt(t);i>100&&(i=100),0>i&&(i=0),this.transparency!=i&&(this.transparency=i,this.addChangeState("transparency",this.transparency),this._firePaintRequest({transparency:i}))},getTransparency:function(){var t=this.options;return this.transparency},setBorderWeight:function(t){var e=this._util.parseInt(t);e>5&&(e=5),0>e&&(e=0),this.outborderweight=e,this.addChangeState("outborderweight",this.outborderweight),this._firePaintRequest({change:!0})},getBorderWeight:function(){return this.outborderweight},setBorderColor:function(t){var e=this.options,i=this._util.parseColor(t);this.bordercolor.toHexString()!=i.toHexString()&&(this.bordercolor=i,this.addChangeState("bordercolor",this.bordercolor),this._firePaintRequest({borderColor:i}))},getBorderColor:function(){return this._util.parseColor(this.bordercolor).toHexString(!1)},setScale:function(t){var e=this._util.parseNumber(t);e/=100,e>0&&(this.oldscaleValue=this.scale,this.scale=e,this._firePaintRequest({scale:e}))},getScale:function(){return 100*this.scale},setCaptionText:function(t){var e=this.options,i=this._util.parseString(t);this.captiontext=i,this.captiontextwidth=-1,this.addChangeState("captiontext",this.captiontext),this._firePaintRequest({change:!0})},getCaptionText:function(){return this.getTextByVar(this.captiontext)},getNormalPos:function(){var t={};if(t.left=parseFloat($(this.element).css("left")),t.top=parseFloat($(this.element).css("top")),this.scale!=this.oldscaleValue){var e=this.oldscaleValue-this.scale;t.left=t.left+e*this.options._w/2,t.top=t.top+e*this.options._h/2}return t},getPos:function(){var t=this._super();return this.currentBoundingWidth&&this.currentWidth&&(t.left=t.left-(this.currentBoundingWidth-this.currentWidth)/2,t.left=Math.round(t.left),t.top=t.top-(this.currentBoundingHeight-this.currentHeight)/2,t.top=Math.round(t.top)),t},setPos:function(t){if(this.currentBoundingWidth&&this.currentWidth){t=this._util.parsePosition(t);var e=Math.round(t[0]+(this.currentBoundingWidth-this.currentWidth)/2),i=Math.round(t[1]+(this.currentBoundingHeight-this.currentHeight)/2),s={};s.left=e,s.top=i,this._super(s)}else this._super(t)},getFxElement:function(){return this.element},_paintWidgetShow:function(t){if(_.has(t,"borderColor")&&this._borderdiv.css("border-color",t.borderColor),_.has(t,"transparency")&&this.element.css("opacity",(100-t.transparency)/100),_.has(t,"change")&&this._changeContent(),_.has(t,"scale")&&this._changeContent(!0),_.has(t,"updateTextByVar")&&(this.captiontextwidth=-1,this._changeContent()),_.has(t,"angle")){this.intervalId&&(clearInterval(this.intervalId),this.element.css("transform","rotate("+this.ratateParam[2]+"deg)"));var e=this,i=this.element[0].style.transform,s=i.split("("),r=s[1].substring(0,s[1].length-4);r=parseFloat(r),r=10*r,r=Math.round(r),r/=10;var n=t.angle,o=(n-r)%360;if(0!=o){o%=360;var a=o/10;this.ratateParam=[a,10,this.angle],this.intervalId=setInterval(function(){e.rotateImage()},40)}}this.currentWidth=this._inslideborderdiv.get(0).offsetWidth,this.currentHeight=this._inslideborderdiv.get(0).offsetHeight,this.currentBoundingWidth=this._inslideborderdiv.get(0).getBoundingClientRect().width,this.currentBoundingHeight=this._inslideborderdiv.get(0).getBoundingClientRect().height,this._super(t)},getTabElementMap:function(){var t={};return t.texts=this.getTabElementLabel(),t.tabElements=this.createTabElement(),t},getTabElementLabel:function(){var t=[];return t},createTabElement:function(){var t=this.options,e=this,i=[];if(t.link){var s=this.getScreenReaderTabElement();if(s){var n=s[0];return n.css("width",this.element.css("width")),n.css("height",this.element.css("height")),s}this.tabDiv?this.tabDiv.empty():(this.tabDiv=$("<div>").appendTo(this.element),this.tabDiv.addClass("notouch"));var n=$("<a>").appendTo(this.tabDiv);n.css("display","block"),n.css("width",this.element.css("width")),n.css("height",this.element.css("height")),n.attr("href",t.link.link),n.click(function(){event.preventDefault(),e.options.link!=r&&""!=e.options.link&&e.handleLinkData(e.options.link)}),i.push(n)}return i},setAngle:function(t){var e=this._util.parseNumber(t);t=e%360,t!=this.angle&&(this.angle=t,this.addChangeState("angle",this.angle),this._firePaintRequest({angle:e}))},getAngle:function(){return this.angle},rotateImage:function(){var t=this,e=this.ratateParam[0],i=this.ratateParam[1],s=t.element[0].style.transform,n=s.split("("),o=n[1].substring(0,n[1].length-4);o=parseFloat(o),o=10*o,o=Math.round(o),o/=10,1==i?(t.element.css("transform","rotate("+t.angle+"deg)"),clearInterval(t.intervalId),this.ratateParam=r,t.intervalId=r,t.currentWidth=t._inslideborderdiv.get(0).offsetWidth,t.currentHeight=t._inslideborderdiv.get(0).offsetHeight,t.currentBoundingWidth=t._inslideborderdiv.get(0).getBoundingClientRect().width,t.currentBoundingHeight=t._inslideborderdiv.get(0).getBoundingClientRect().height,t._changeContent()):(o+=e,o%=360,this.ratateParam[1]=i-1,t.element.css("transform","rotate("+o+"deg)"))},focus:function(){var t=this.options;if(t.link){var e=this.getScreenReaderTabElement();if(e&&0!=e.length){var i=e[0];this.doSetFocus(i)}}},_getLimitPos:function(){var t=this.getFxElement(),e=t.children("div");if(null!=t&&0!=e.length){var i=[parseInt(e.css("left")),parseInt(e.css("top"))],s=this._util.getRotateSize([parseInt(e.css("width")),parseInt(e.css("height"))],this.getAngle()),r=Number(i[0]),n=Number(i[1]),o=Number(i[0]+s[0]),a=Number(i[1]+s[1]),h=[];h.push(r),h.push(n),h.push(o),h.push(a),h=this._getMaxBounds(h,e);var l=[];if(l.push(h[0]),l.push(h[1]),0!=this.angle){var c=parseInt($(this.element).css("width")),u=parseInt($(this.element).css("height")),d=this.getSize();l[0]=l[0]-(d[0]-c)/2,l[1]=l[1]-(d[1]-u)/2}return l}var l=[];return l.push(this.getPos().left),l.push(this.getPos().top),l},_getMaxBounds:function(t,e){var i=t[0],s=t[1],n=t[2],o=t[3],a=t;if(null!=e){if(0!=e.children("div").length)for(var h=e.children("div");null!=h&&h.is("div");)a=this._getMaxBounds(a,h),i=a[0],s=a[1],n=a[2],o=a[3],h=h.next();if(e.css("left")!=r&&e.css("top")!=r&&e.css("width")!=r&&e.css("height")!=r){var l=[parseInt(e.css("left")),parseInt(e.css("top"))],c=this._util.getRotateSize([parseInt(e.css("width")),parseInt(e.css("height"))],this.getAngle()),u=Number(l[0]),d=Number(l[1]),p=Number(l[0]+c[0]),f=Number(l[1]+c[1]);i=i>u?u:i,s=s>d?d:s,n=n>p?n:p,o=o>f?o:f}}var g=[];return g.push(i),g.push(s),g.push(n),g.push(o),g},_getRealBounds:function(){var t=this.getFxElement(),e=t.children("div");if(null!=t&&0!=e.length){var i=[parseInt(e.css("left")),parseInt(e.css("top"))],s=this._util.getRotateSize([parseInt(e.css("width")),parseInt(e.css("height"))],this.getAngle()),r=Number(i[0]),n=Number(i[1]),o=Number(i[0]+s[0]),a=Number(i[1]+s[1]),h=[];h.push(r),h.push(n),h.push(o),h.push(a),h=this._getMaxBounds(h,e);var l=this.getPos(),c=Number(l.left)+h[0],u=Number(l.top)+h[1],d=h[2]-h[0],p=h[3]-h[1],f=[];return f.push(c),f.push(u),f.push(d),f.push(p),f}var f=[];return f.push(this.getPos().left),f.push(this.getPos().top),f.push(this.getSize()[0]),f.push(this.getSize()[1]),f},addChangeState:function(t,e){this.stateChangeMap[t]=e},_destroy:function(t){$(this.img).off(),this._super(t)}}),a}),define("text!widgets/com.smartbuilder.axon.widget.button/svg.html",[],function(){return'<div\r\n	style="position: relative; text-align: center; width: 100%; height: 100%;">\r\n	<svg aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg"\r\n		xmlns:xlink="http://www.w3.org/1999/xlink"\r\n		xmlns:svg="http://www.w3.org/2000/svg"\r\n		contentScriptType="text/ecmascript" display="block" width="100%" zoomAndPan="magnify"\r\n		contentStyleType="text/css" height="100%" preserveAspectRatio="none"\r\n		version="1.0">\r\n		'}),define("lib/css!widgets/com.smartbuilder.axon.widget.button/style",[],function(){}),define("text!widgets/com.smartbuilder.axon.widget.button/text.html",[],function(){return'</svg>\r\n<div id="text"></div>\r\n</div>'}),define("wgt/com.smartbuilder.axon.widget.button/s",["module","sb4core/sbobj","text!widgets/com.smartbuilder.axon.widget.button/svg.html","css!widgets/com.smartbuilder.axon.widget.button/style.css","text!widgets/com.smartbuilder.axon.widget.button/styles.xml","text!widgets/com.smartbuilder.axon.widget.button/text.html"],function(t,e,i,s,r,n){var o=t.config(),a=o.widgetsvc,h=a.getShortUIKey();return $("#sb4Svg").append(r),$.widget(a.getFullUIKey(),$.sb4[e],{options:{},_create:function(){this.element.addClass(h),this._super(),this.applyProfileFlag||(this.clkCnt=0,this.lineColor=this.options.line,this.lineWidth=this.options.lineWidth,this.disabled=this.options.disabled,this.textValue=this.options.text,this.textColorValue=this._util.parseColor(this.options.fontColor),this.normalColorValue=this.textColorValue,this.transparency=this.options.transparency,this.state=this.options.state),this.rootshapeId=_.uniqueId("rootshape_"),this.rootshapeJQueryId="#"+this.rootshapeId,this.rootshapeGroupId=this.rootshapeId+"_g",this.rootshapeShadowId=this.rootshapeId+"_shadow",this.attr={},this.options.underline&&(this.attr.textDecoration="underline"),this.scaleValue=1;var t=this.options._x-this.getPosOffset(),e=this.options._y-this.getPosOffset(),s=this.options._w+this.getSizeOffset(),r=this.options._h+this.getSizeOffset();if(this.element.css("left",t+"px"),this.element.css("top",e+"px"),this.element.css("width",s+"px"),this.element.css("height",r+"px"),this.shadowValue=this.options.shadow,void 0!=this.shadowValue&&"use"==this.shadowValue.shadow){this.shadowdiv=$("<div>").appendTo(this.element),this.shadowdiv.attr("class","notouch"),this.shadowdiv.html(this._util.createShadowSvg(this.rootshapeShadowId,this.rootshapeGroupId,this.shadowValue,s,r)),this.options.margin>0&&($("#"+this.rootshapeShadowId).attr("x",this.options.margin),$("#"+this.rootshapeShadowId).attr("y",this.options.margin)),this.shadowdiv.attr("style","position:absolute; text-align:center;");var n=this.getShadowBounds();this.setTextStyleValue(this.shadowdiv,n[1],n[0],n[2],n[3])}this.filllist=JSON.parse(this.options.filllist),this.stateFillValue=this.options.statefillvalue,this.toggle=this.options.toggle,this.fillMap={};var o=this;_.map(this.filllist,function(t,e){if("gradient"==t.typeValue){var i='<linearGradient x1="'+t.x1+'" y1="'+t.y1+'" x2="'+t.x2+'" y2="'+t.y2+'">';_.each(t.stopList,function(e,s){i+='<stop stop-color="rgb('+e.color.red+","+e.color.green+","+e.color.blue+')" offset="'+e.position+'%" stop-opacity="'+(1-e.opacity/100)+'"></stop>',1==t.stopList.length&&(i+='<stop stop-color="rgb('+e.color.red+","+e.color.green+","+e.color.blue+')" offset="100%" stop-opacity="'+(1-e.opacity/100)+'"></stop>')}),i+=" </linearGradient>";var s=o._util.cacheFillSvg(i,"fill_",o.element);o.fillMap[e]="url("+s+")"}else o.fillMap[e]=o.stateFillValue[e]});for(var l=0;4>l;l++){var c=l+"";_.has(this.fillMap,c)||(this.fillMap[c]=this.fillMap[0])}for(var u="",d="",p=0;4>p;p++){switch(p){case 0:d="normal";break;case 1:d="hover";break;case 2:d="down";break;case 3:d="disabled"}if(null!=this.options[d+"image"]&&this.options[d+"image"].length>0){var f=a.getWidgetAssetURI(this.options[d+"image"]);u+=' <pattern id="'+this.options._i+d+'img" patternUnits="userSpaceOnUse" width="'+this.options._w+'" height="'+this.options._h+'"> <image width="'+this.options._w+'" height="'+this.options._h+'" preserveAspectRatio="none" xlink:href="'+f+'" ></image></pattern>'}}var g="";if("use"==this.shadowValue.shadow&&(g=this.options.group.replace(/rootshape/g,this.rootshapeGroupId)),this.div=$(i+"<defs>"+u+g+"</defs>"+this.options.group.replace(/rootshape/g,this.rootshapeId)+"</svg></div>").appendTo(this.element),$(this.rootshapeJQueryId).attr("style",this.options.styleValue.replace("simg",this.options._i+"simg")),this.options.hand&&!this.disabled&&$(this.rootshapeJQueryId).css("cursor","pointer"),$(this.rootshapeJQueryId).css("stroke-width",this.lineWidth),this.setTextStyleValue(this.div,-this.options.margin,-this.options.margin,this.options._w+this.getSizeOffset()+2*this.options.margin,this.options._h+this.getSizeOffset()+2*this.options.margin),this.element.addClass("notouch"),this.element.find(this.rootshapeJQueryId).css("pointer-events","painted"),void 0!=this.options.icon&&this.options.icon.isUseIcon){var v=this.options.iconSvg;v&&this._util.cacheIconSvg(v,this.options.icon.imageName);var m=this.options.icon;(void 0==m.viewBox||0==m.viewBox.length)&&(m.viewBox="0 0 32 32"),this.icon=$('<svg focusable="false"viewBox="'+m.viewBox+'"><use id="icon" xlink:href="#'+m.imageName+'" fill="'+this._util.parseColor(m.color)+'"></use></svg>').appendTo(this.div),this.icon.attr("aria-hidden","true"),this.icon.attr("class","notouch");var b=0;switch(m.alignType){case 0:b=this.options.margin+this.getPosOffset()+m.offset;break;case 1:b=(this.options._w+2*this.options.margin+this.getPosOffset()-m.buttonSize)/2;break;case 2:b=this.options._w+this.options.margin+this.getPosOffset()-m.buttonSize-m.offset}this.icon.attr("style","position:absolute;top:"+(this.options._h+2*(this.options.margin+this.getPosOffset())-m.buttonSize)/2+"px;left:"+b+"px;width:"+m.buttonSize+"px;height:"+m.buttonSize+"px;"),this.icon.css("opacity",1-this.transparency/100)}this.textflow=$("<div>").appendTo(this.div),this.textflow.attr("class","notouch"),this.textflow.css("opacity",1-this.transparency/100),this.setTextStyleValue(this.textflow,this.options.margin,this.options.margin,s,r),this.replaceAttrValue(this.textflow,"overflow","hidden"),this.text=$("<div>").appendTo(this.textflow);var x=s-20;this.drawText("shapetext",this.textValue,this.text,this.options.font,this.options.align,this.textColorValue,x,void 0,this.attr,void 0),this.options.showtext?this.text.removeClass("notVisible"):this.text.addClass("notVisible");
var y=this.text.width(),w=this.text.height(),S=this.text.get(0).getBoundingClientRect().width,T=this.text.get(0).getBoundingClientRect().height,I=(this.options._w-y)/2;switch(this.options.align){case 0:I=10;break;case 2:I=this.options._w-10-y}var B=(r-w)/2;w>r&&(B=0),this.setTextStyleValue(this.text,B,I,y,w),this.changeState(this.disabled?3:this.state),3!=this.state&&(this.normalShapeStyleValue=this.element.find(this.rootshapeJQueryId).attr("style"),this.normalTransformValue=this.element.find(this.rootshapeJQueryId).attr("transform"),this.normalClassValue=this.element.find(this.rootshapeJQueryId).attr("class")),this.element.find(this.rootshapeJQueryId).attr("transform","translate("+this.getTranslateValue()+","+this.getTranslateValue()+")"),this.applyProfileFlag&&this.fillcolor&&this.setFillColor(this.fillcolor),this.setScreenReaderElement(this.getTabElementMap())},getShadowBounds:function(){var t=1,e=this.options,i=this.options.margin-this.getSizeOffset(),s=this.shadowValue.size/100,r=4*this.shadowValue.radius,n=this.shadowValue.angle,o=this.shadowValue.distance,a=Math.cos(n*Math.PI/180)*o,h=Math.sin(n*Math.PI/180)*o,l=(e._w+2*i)*s+2*r,c=(e._h+2*i)*s+2*r,u=(e._w-l)/2,d=(e._h-c)/2,p=a+u,f=h+d;return[p*t,f*t,l*t,c*t]},clearFillColor:function(){this.element.find("#rootshape").css("fill","")},setFillImage:function(t){var e="normal";if(void 0!=this.filllist[t])switch(t){case 0:e="normal";break;case 1:e="hover";break;case 2:e="down";break;case 3:e="disabled"}this.element.find(this.rootshapeJQueryId).css("fill","url(#"+this.options._i+e+"img)")},setSolidFillColor:function(t){t=this._util.parseColor(t);var e=t.toHexString(255).substring(0,7);this.element.find(this.rootshapeJQueryId).css("fill",e)},setFillColor:function(t){this.setSolidFillColor(t),this.fillcolor=this._util.getColorHexString(t),this._firePaintRequest({fillcolor:t})},getFillColor:function(){return this.fillcolor?this.fillcolor:this._util.parseColor(this.element.find(this.rootshapeJQueryId).css("fill")).toHexString()},setLineColor:function(t){this.lineColor=this._util.parseColor(t),this._firePaintRequest({linecolor:this.lineColor})},getLineColor:function(){return this.lineColor},setTextColor:function(t){t=this._util.parseColor(t),this._firePaintRequest({textcolor:t})},getTextColor:function(){return this.textColorValue},setLineWeight:function(t){this.lineWidth=this._util.parseInt(t),this._firePaintRequest({linewidth:this.lineWidth})},getLineWeight:function(){return this._util.parseInt(this.lineWidth)},setText:function(t){t=this._util.parseString(t),this.textValue=t,this._firePaintRequest({text:t})},getText:function(){return this.getTextByVar(this.textValue)},getScale:function(){return this.scaleValue},setScale:function(t){if(t=this._util.parseNumber(t),t>0){var e=(this.getPosOffset()+this.options.margin)*t,i=this.getPos().left-this.getPosOffset()+Math.floor((1-t)*this.options._w/2),s=this.getPos().top-this.getPosOffset()+Math.floor((1-t)*this.options._h/2),r=(this.options._w+this.getSizeOffset())*t,n=(this.options._h+this.getSizeOffset())*t;this.element.css("left",i+"px"),this.element.css("top",s+"px"),this.element.css("width",r+"px"),this.element.css("height",n+"px"),this.scaleValue=t,this.setTextStyleValue(this.div,-this.options.margin*t,-this.options.margin*t,r+2*this.options.margin*t,n+2*this.options.margin*t),this.setTextStyleValue(this.textflow,e-this.getPosOffset()*t,e-this.getPosOffset()*t,r,n);var o,a,h=r-20;if(this.textValue==this.options.text)this.drawText("shapetext",this.options.text,this.text,this.options.font,this.options.align,this.textColorValue,h,t,this.attr,void 0),o=this.text.width(),a=this.text.height();else{this.setTextStyleValue(this.text,0,0,r-20,n);var l=this.options.font.fontSize,c=l*t;this.options.font.fontSize=c,this.drawText("shapetext",this.textValue,this.text,this.options.font,this.options.align,this.textColorValue,-1*h),this.options.font.fontSize=l,o=this.text.css("width").replace("px",""),a=this.text.css("height").replace("px",""),this.options.underline&&this.replaceAttrValue(this.text,"text-decoration","underline")}o>r&&(o=r),a>n&&(a=n);var u=(r-o)/2;switch(this.options.align){case 0:u=10;break;case 2:u=r-10-o}this.setTextStyleValue(this.text,(n-a)/2,u,o,a),this.element.find(this.rootshapeJQueryId).attr("transform","translate("+this.getTranslateValue()+","+this.getTranslateValue()+")")}},getTransparency:function(){return this.transparency},setTransparency:function(t){t=this._util.parseNumber(t),this._firePaintRequest({transparency:t})},getEnabled:function(){return!this.disabled},setEnabled:function(t){t=this._util.parseBoolean(t),this.disabled=!t,this._firePaintRequest({enabled:t})},getSelected:function(){return this.toggle&&2==this.state?!0:!1},setSelected:function(t){3!=this.state&&(t=this._util.parseBoolean(t),this._firePaintRequest({selected:t}))},changeState:function(t){if(this.state=t,this.removeAttrValue(this.element.find(this.rootshapeJQueryId),"filter"),this.removeAttrValue(this.element.find("#icon"),"filter"),this.element.find(this.rootshapeJQueryId).attr("transform",this.normalTransformValue),this.element.find(this.rootshapeJQueryId).attr("class",this.normalClassValue),this.options.hand&&3!=t?this.element.find(this.rootshapeJQueryId).css("cursor","pointer"):this.element.find(this.rootshapeJQueryId).css("cursor",""),void 0!=this.filllist[t]){if(this.element.find(this.rootshapeJQueryId).attr("style",this.normalShapeStyleValue),this.changeFillType(this.filllist[t].typeValue,this.stateFillValue[t],t),this.element.find(this.rootshapeJQueryId).css("fill-opacity",""),"solid"==this.filllist[t].typeValue){var e=this._util.parseInt(this.filllist[t].opacity);e>0&&this.element.find(this.rootshapeJQueryId).css("fill-opacity",this._util.getOpacityByTransparency(e))}}else{switch(this.changeFillType(this.filllist[0].typeValue,this.stateFillValue[0],t),t){case 0:break;case 1:var i="",s=null;if("gradient"==this.filllist[0].typeValue&&this.filllist[0].stopList.length>1)this.replaceAttrValue(this.element.find(this.rootshapeJQueryId),"filter","url(#buttondarksvg)");else{if("gradient"==this.filllist[0].typeValue&&1==this.filllist[0].stopList.length){var r=this.checkWhite(this.filllist[0].stopList[0].color,t,!0);i=r}else if("solid"==this.filllist[0].typeValue){var r=this.filllist[0].solidColor;r||(r=this.getFillColor()),r=this.checkWhite(r,t,!0),i=r}else if("white"==this.filllist[0].typeValue){var n=this.getLineWeight(),r=this.getLineColor();0==n&&(r=this.normalColorValue),r=this.checkWhite(r,t,!0),i=r}else"none"==this.filllist[0].typeValue&&this.options.hoverDefaultColor&&(this.textColorValue=this.checkWhite(this.normalColorValue,t,!0));0!=i.length?this.element.find(this.rootshapeJQueryId).css("fill",i):this.element.find(this.rootshapeJQueryId).css("filter","url(#buttondarksvg)")}break;case 2:if("gradient"==this.filllist[0].typeValue&&this.filllist[0].stopList.length>1);else{var o="";if("gradient"==this.filllist[0].typeValue&&1==this.filllist[0].stopList.length){var r=this.checkWhite(this.filllist[0].stopList[0].color,t,!0);o=r}else if("solid"==this.filllist[0].typeValue){var r=this.filllist[0].solidColor;r||(r=this.getFillColor()),r=this.checkWhite(r,t,!0),o=r}else if("white"==this.filllist[0].typeValue){var n=this.getLineWeight(),r=this.getLineColor();0==n&&(r=this.normalColorValue),r=this.checkWhite(r,t,!0),o=r}else"none"==this.filllist[0].typeValue&&this.options.hoverDefaultColor&&(this.textColorValue=this.checkWhite(this.normalColorValue,t,!0));0!=o.length?this.element.find(this.rootshapeJQueryId).css("fill",o):this.element.find(this.rootshapeJQueryId).css("filter","url(#buttonlightsvg)")}break;case 3:this.replaceAttrValue(this.element.find(this.rootshapeJQueryId),"filter","url(#buttongarysvg)"),this.options.disabledDefaultColor&&(this.replaceAttrValue(this.element.find("#icon"),"filter","url(#buttongarysvg)"),this.textColorValue=this.colorLuminance(this.normalColorValue,-.05,!0))}if(this.element.find(this.rootshapeJQueryId).css("fill-opacity",""),"solid"==this.filllist[0].typeValue){var e=this._util.parseInt(this.filllist[0].opacity);e>0&&this.element.find(this.rootshapeJQueryId).css("fill-opacity",this._util.getOpacityByTransparency(e))}}0==t?(this.element.find("#icon").attr("fill",this._util.parseColor(this.options.icon.color)),this.textColorValue=this.normalColorValue,this.element.find(this.rootshapeJQueryId).css("stroke",this.lineColor)):1==t?this.options.hoverDefaultColor?(this.element.find("#icon").attr("fill",this._util.parseColor(this.options.icon.color)),this.textColorValue=this.normalColorValue,this.element.find(this.rootshapeJQueryId).css("stroke",this.lineColor)):(this.element.find("#icon").attr("fill",this._util.parseColor(this.options.hoverIconColor)),this.textColorValue=this._util.parseColor(this.options.hoverFontColor),this.element.find(this.rootshapeJQueryId).css("stroke",this.options.hoverLineColor)):2==t?this.options.downDefaultColor?(this.element.find("#icon").attr("fill",this._util.parseColor(this.options.icon.color)),this.textColorValue=this.normalColorValue,this.element.find(this.rootshapeJQueryId).css("stroke",this.lineColor)):(this.element.find("#icon").attr("fill",this._util.parseColor(this.options.downIconColor)),this.textColorValue=this._util.parseColor(this.options.downFontColor),this.element.find(this.rootshapeJQueryId).css("stroke",this.options.downLineColor)):3==t&&(this.options.disabledDefaultColor||(this.element.find("#icon").attr("fill",this._util.parseColor(this.options.disabledIconColor)),this.textColorValue=this._util.parseColor(this.options.disabledFontColor),this.element.find(this.rootshapeJQueryId).css("stroke",this.options.disabledLineColor)));var a=this.scaleValue,h=(this.options._w+this.getSizeOffset())*a,l=(this.options._h+this.getSizeOffset())*a,c=h-20,u,d;if(this.textValue==this.options.text)this.drawText("shapetext",this.options.text,this.text,this.options.font,this.options.align,this.textColorValue,c,a,this.attr,void 0),u=this.text.width(),d=this.text.height();else{this.setTextStyleValue(this.text,0,0,h-20,l);var p=this.options.font.fontSize,f=p*a;this.options.font.fontSize=f,this.drawText("shapetext",this.textValue,this.text,this.options.font,this.options.align,this.textColorValue,-1*c),this.options.font.fontSize=p,u=this.text.css("width").replace("px",""),d=this.text.css("height").replace("px",""),this.options.underline&&this.replaceAttrValue(this.text,"text-decoration","underline")}var g=(h-u)/2;switch(this.options.align){case 0:g=10;break;case 2:g=h-10-u}var v=(l-d)/2;d>l&&(v=0),this.setTextStyleValue(this.text,v,g,u,d),this.element.find(this.rootshapeJQueryId).attr("transform","translate("+this.getTranslateValue()+","+this.getTranslateValue()+")"),this.toggle&&this.setScreenReaderElement(this.getTabElementMap())},checkWhite:function(t,e,i){if(1==e){var s=jQuery.Color(t).lightness();s+=.3*(1-s),s>1&&(s=1),t=jQuery.Color(t).lightness(s)}else if(2==e){var s=jQuery.Color(t).lightness();s-=.3*s,0>s&&(s=0),t=jQuery.Color(t).lightness(s)}return t},changeWhiteFillType:function(t,e){switch(this.textColorValue=this.textColorValue,e){case 0:this.setSolidFillColor(t),this.removeAttrValue(this.element.find(this.rootshapeJQueryId),"filter"),this.removeAttrValue(this.element.find("#icon"),"filter");break;case 1:this.setSolidFillColor(this.options.line),this.replaceAttrValue(this.element.find(this.rootshapeJQueryId),"filter","url(#buttonlightsvg)"),this.removeAttrValue(this.element.find("#icon"),"filter");break;case 2:this.setSolidFillColor(this.options.line),this.replaceAttrValue(this.element.find(this.rootshapeJQueryId),"filter","url(#buttondarksvg)"),this.removeAttrValue(this.element.find("#icon"),"filter");break;case 3:this.setSolidFillColor(t),this.replaceAttrValue(this.element.find(this.rootshapeJQueryId),"filter","url(#buttongarysvg)"),this.options.disabledDefaultColor&&(this.replaceAttrValue(this.element.find("#icon"),"filter","url(#buttongarysvg)"),this.textColorValue=this.colorLuminance(this.normalColorValue,-.05,!0));break;default:this.setSolidFillColor(t),this.removeAttrValue(this.element.find(this.rootshapeJQueryId),"filter"),this.removeAttrValue(this.element.find("#icon"),"filter")}},changeFillType:function(t,e,i){switch(this.clearFillColor(),t){case"gradient":this.element.find(this.rootshapeJQueryId).css("fill",this.fillMap[i]);break;case"white":if(e.split(" | ").length>1){var s=e.split(" | ")[0],r=e.split(" | ")[1];this.setSolidFillColor(r)}else this.setSolidFillColor(e);break;case"solid":if(e.split(" | ").length>1){var s=e.split(" | ")[0],n=e.split(" | ")[1];this.setSolidFillColor(n)}else this.setSolidFillColor(e);break;case"image":if(e.split(" | ").length>1)var s=e.split(" | ")[0],n=e.split(" | ")[1];this.setFillImage(i);break;case"none":this.element.find(this.rootshapeJQueryId).css("fill","url(#sb4FillNone)")}},hexToRgb:function(t){return t=this._util.parseColor(t),[t._rgba[0],t._rgba[1],t._rgba[2]]},colorLuminance:function(t,e,i){if(t=this._util.parseColor(t),i){var s=this.hexToRgb(t),r=(s[0]+s[1]+s[2])/3;if(t=this.rgbToHex(r,r,r),0==r){var n="#808080";return n}}t=String(t).replace(/[^0-9a-f]/gi,""),t.length<6&&(t=t[0]+t[0]+t[1]+t[1]+t[2]+t[2]),e=e||0;var n="#",o,a;for(a=0;3>a;a++)o=parseInt(t.substr(2*a,2),16),o=Math.round(Math.min(Math.max(0,o+o*e),255)).toString(16),n+=("00"+o).substr(o.length);return n},componentToHex:function(t){var e=t.toString(16);return 1==e.length?"0"+e:e},rgbToHex:function(t,e,i){return"#"+this.componentToHex(t)+this.componentToHex(e)+this.componentToHex(i)},setTextStyleValue:function(t,e,i,s,r){var n="center";switch(this.options.align){case 0:n="left";break;case 1:n="center";break;case 2:n="right"}this.replaceAttrValue(t,"position","absolute"),this.removeAttrValue(t,"text-align"),null!=s&&this.replaceAttrValue(t,"width",s),null!=r&&this.replaceAttrValue(t,"height",r),null!=e&&this.replaceAttrValue(t,"top",e),null!=i&&this.replaceAttrValue(t,"left",i),this.replaceAttrValue(t,"text-align",n)},replaceAttrValue:function(t,e,i){if(!(t.length<1)){i=this._util.parseString(i);var s=t.attr("style");if(void 0==s&&(t.attr("style","position:absolute;"),s=t.attr("style")),-1==s.search(e+":absolute"))if(-1==s.search(e))s+="top"==e||"left"==e||"width"==e||"height"==e?e+":"+i+"px;":e+":"+i+";",t.attr("style",s);else{var r=s.substring(0,s.search(e)),n=s.substring(s.indexOf(";",s.search(e))+1,s.length+1);"top"==e||"left"==e||"width"==e||"height"==e?t.attr("style",r+e+":"+i+"px;"+n):t.attr("style",r+e+":"+i+";"+n)}}},removeAttrValue:function(t,e){var i=t.attr("style");if(!(t.length<1)&&(void 0==i&&(t.attr("style","position:absolute;"),i=t.attr("style")),-1!=i.search(e))){var s=i.substring(0,i.search(e)),r=i.substring(i.indexOf(";",i.search(e))+1,i.length+1);t.attr("style",s+r)}},highlight:function(t){var e=this.element.find(this.rootshapeJQueryId),i=this.element.find("#highlightshape");t?0==i.length&&(i=e.clone().appendTo(e.parent()),i.attr("id","highlightshape"),i.css("fill","#c77405"),i.css("opacity","0.5"),i.attr("class","notouch"),i.css("pointer-events","")):i.length>0&&i.remove()},getFxElement:function(){return this.element},_refreshFxElement:function(){for(var t=this.getFxElement().find("use"),e=0;e<t.length;e++){var i=t.eq(e);i.attr("xlink:href",i.attr("xlink:href"))}},_paintWidgetHide:function(t){this.changeState(this.disabled?3:0),this._super(t)},_paintWidgetShow:function(t){if(_.has(t,"enabled")&&(t.enabled?(this.disabled=!1,this.changeState(0)):(this.disabled=!0,this.changeState(3)),this.setScreenReaderElement(this.getTabElementMap())),_.has(t,"selected")&&this.toggle&&this.changeState(t.selected?2:0),_.has(t,"fillcolor")&&(this.filllist[0].typeValue="solid",this.stateFillValue[0]=-1!=this.stateFillValue[0].indexOf("style")?-1!=this.stateFillValue[0].indexOf("|")?this.stateFillValue[0].split("|")[0]+"| "+t.fillcolor:this.stateFillValue[0]+" | "+t.fillcolor:s),_.has(t,"linecolor")&&this.element.find(this.rootshapeJQueryId).css("stroke",t.linecolor),_.has(t,"linewidth")){this.lineWidth=t.linewidth,this.element.find(this.rootshapeJQueryId).css("stroke-width",this.lineWidth);var e=$(this.rootshapeJQueryId).find("rect");if(0!=e.length){var i=e.eq(0);0==this.lineWidth?(i.attr("width",this.options._w),i.attr("height",this.options._h)):(i.attr("width",this.options._w-1),i.attr("height",this.options._h-1))}this.setScale(this.scaleValue)}if(_.has(t,"text")&&(this.text.empty(),this.textValue=t.text,this.setScale(this.scaleValue),this.setScreenReaderElement(this.getTabElementMap())),_.has(t,"updateTextByVar")&&(this.text.empty(),this.setScale(this.scaleValue),this.setScreenReaderElement(this.getTabElementMap())),_.has(t,"textcolor")){var s=t.textcolor.toHexString(255).substring(0,7);this.textColorValue=s,this.normalColorValue=this.textColorValue,this.setScale(this.scaleValue)}if(_.has(t,"transparency")){this.transparency=t.transparency;var r=1-this.transparency/100;this.textflow.css("opacity",r),this.setStyleTransparency(this.rootshapeId,r),this.setStyleTransparency("shadow",r),this.setStyleTransparency("icon",r)}3!=this.state&&(this.normalShapeStyleValue=this.element.find(this.rootshapeJQueryId).attr("style"),this.normalTransformValue=this.element.find(this.rootshapeJQueryId).attr("transform")),this._super(t)},_init:function(){this._debug("init called");var t=this;this.element.find(this.rootshapeJQueryId).click(function(){3!=t.state&&(void 0!=t.options.link&&""!=t.options.link&&t.handleLinkData(t.options.link),t.clkCnt++,t.fireEvent("onClick"))}),this.element.find(this.rootshapeJQueryId).on("vmousedown",function(){3!=t.state&&(t.toggle?(t.changeState(2==t.state?1:2),t.setScreenReaderElement(t.getTabElementMap())):t.changeState(2))}),this.element.find(this.rootshapeJQueryId).on("vmouseup",function(){3!=t.state&&(t.toggle||t.changeState(1))}),this.element.find(this.rootshapeJQueryId).dblclick(function(){3!=t.state&&t.fireEvent("onDoubleClick")}),this.element.find(this.rootshapeJQueryId).on("vmouseover",function(){3!=t.state&&(t.toggle?2!=t.state&&t.changeState(1):t.changeState(1),t.fireEvent("onRollover"))}),this.element.find(this.rootshapeJQueryId).on("vmouseout",function(){3!=t.state&&(t.toggle?2!=t.state&&t.changeState(0):t.changeState(0),t.fireEvent("onRollout"))})},getTabElementMap:function(){var t={};return t.texts=this.getTabElementLabel(),t.tabElements=this.createTabElement(),t},getTabElementLabel:function(){var t=[];return t.push(this.getTextByVar(_.isEmpty(this.textValue)?this.options._n:this.textValue)),t},changeDeviceButtonToggle:function(){var t=$("button",this.element),e=t.eq(0).attr("aria-pressed");e="false"==e?!0:!1,t.eq(0).attr("aria-pressed",e)},createTabElement:function(){var t=this.getScreenReaderTabElement();if(t){var e=t[0];return this.disabled?e.attr("disabled","disabled"):e.removeAttr("disabled"),this.toggle&&(2==this.state?e.attr("aria-pressed",!0):e.attr("aria-pressed",!1)),t}var i=[];this.tabDiv?this.tabDiv.empty():(this.tabDiv=$("<div>").prependTo(this.element),this.tabDiv.css("width","100%"),this.tabDiv.css("height","100%"),this.tabDiv.addClass("notouch"));var e=$("<button>").appendTo(this.tabDiv);this.disabled&&e.attr("disabled","disabled"),this.toggle&&(2==this.state?e.attr("aria-pressed",!0):e.attr("aria-pressed",!1));var s=this;return e.click(function(){3!=s.state&&(void 0!=s.options.link&&""!=s.options.link&&s.handleLinkData(s.options.link),s.toggle&&(s.changeState(2==s.state?1:2),s.setScreenReaderElement(s.getTabElementMap())),s.clkCnt++,s.fireEvent("onClick"))}),e.dblclick(function(){3!=s.state&&s.fireEvent("onDoubleClick")}),e.focus(function(t){s.fireEvent("onFocus")}),i.push(e),i},focus:function(){var t=this.getScreenReaderTabElement();if(t&&0!=t.length){var e=t[0];this.doSetFocus(e)}},getXAPIResult:function(){var t=this._super();return t.response=this.clkCnt+"",t},getPos:function(){var t=this._super();return t.left=t.left+this.getPosOffset(),t.top=t.top+this.getPosOffset(),t},setPos:function(t){var e=this._util.parsePosition(t),i={};i.left=Math.round(e[0])-this.getPosOffset(),i.top=Math.round(e[1])-this.getPosOffset(),this._super(i)},setStyleTransparency:function(t,e){this.element.find("#"+t).css("opacity",e)},_getLimitPos:function(){var t=this.getFxElement(),e;if(null!=t&&(e=null!=this.shadowdiv?this.shadowdiv:this.div),null!=e){var i=Number(e.css("left").replace("px","")),s=Number(e.css("top").replace("px","")),r=Number(e.css("left").replace("px",""))+Number(e.css("width").replace("px","")),n=Number(e.css("top").replace("px",""))+Number(e.css("height").replace("px","")),o=[];o.push(i),o.push(s),o.push(r),o.push(n),o=this._getMaxBounds(o,e);var a=[];return a.push(o[0]),a.push(o[1]),a}var a=[];return a.push(this.getPos().left),a.push(this.getPos().top),a},_getRealBounds:function(){var t=this.getFxElement(),e;if(null!=t&&(e=null!=this.shadowdiv?this.shadowdiv:this.div),null!=e){var i=Number(e.css("left").replace("px","")),s=Number(e.css("top").replace("px","")),r=Number(e.css("left").replace("px",""))+Number(e.css("width").replace("px","")),n=Number(e.css("top").replace("px",""))+Number(e.css("height").replace("px","")),o=[];o.push(i),o.push(s),o.push(r),o.push(n),o=this._getMaxBounds(o,e);var a=Number(t.css("left").replace("px",""))+o[0],h=Number(t.css("top").replace("px",""))+o[1],l=o[2]-o[0],c=o[3]-o[1],u=[];return u.push(a),u.push(h),u.push(l),u.push(c),u}var u=[];return u.push(this.getPos().left),u.push(this.getPos().top),u.push(this.getSize()[0]),u.push(this.getSize()[1]),u},getPosOffset:function(){return Math.floor(this.lineWidth/2)},getSizeOffset:function(){return 2*this.getPosOffset()},getTranslateValue:function(){return this.options.margin+this.lineWidth/2}}),a.getShortUIKey()}),define("sb4core/init-post",["sb4core/loplayer","image","sb4core/syscheck","sb4core/DataUtil","lib/FileSaver.min","sb4core/linkhandler","wgt/com.smartbuilder.axon.widget.frame/s","wgt/com.smartbuilder.axon.widget.slideset/s","wgt/com.smartbuilder.axon.widget.slide/s","wgt/com.smartbuilder.axon.widget.shape/s","wgt/com.smartbuilder.axon.widget.text.text/s","wgt/com.smartbuilder.axon.widget.text.richtext/s","wgt/com.smartbuilder.axon.widget.image/s","wgt/com.smartbuilder.axon.widget.button/s"],function(t,e,i,s){function r(t,e){function i(t,e){var i=[];for(k in t)i.push(k);return i.join(e)}if(!(t instanceof Date))return"";var s={M:t.getMonth()+1,d:t.getDate(),D:t.getDate(),h:t.getHours(),m:t.getMinutes(),s:t.getSeconds(),y:t.getFullYear(),Y:t.getFullYear()},r=i(s,"+|")+"+",n=new RegExp(r,"g");return e=e.replace(n,function(t){var e=s[t.slice(-1)],i=t.length;if(t.indexOf("y")<0&&t.indexOf("Y")<0)var i=Math.max(t.length,e.toString().length);var r=e.toString().length<t.length?"0".repeat(i):"";return(r+e).slice(-i)})}function n(t){var e=new Date,i=-e.getTimezoneOffset(),s=t-i,r=e.getTime(),n=1e3*s*60,o=new Date(r+n);return o}return SB4API.stageLog("init-post finished"),SB4API.showLoading=function(){"none"==$("#fullscreen").css("display")&&$("#fullscreen").show()},SB4API.hideLoading=function(){"none"!=$("#fullscreen").css("display")&&$("#fullscreen").hide()},SB4API.showLoadingWithOpacity=function(){SB4API.showLoading(),$("#fullscreen").css("background-color","rgba(218, 218, 218, 0)")},SB4API.hideLoadingWithOpacity=function(){SB4API.hideLoading(),$("#fullscreen").css("background-color","")},createjs.TagRequest.prototype._handleTimeout=function(){this._clean(),this.dispatchEvent(new createjs.Event("error"))},null==SB4API.functions&&(SB4API.functions={}),SB4API.functions.getTime=function(t,e){var i=parseInt(e);if(!isNaN(i)&&null!=e&&e.indexOf("Z")>0&&e.indexOf("T")>0&&(i=Date.parse(e)),isNaN(i))if(_.str.startsWith(e,"UTC")){var s=0;if(e.length>4){var o=!1;"-"==e.charAt(3)&&(o=!0);var a=e.substring(4);if(_.str.contains(a,":")){var h=a.split(":"),l=parseInt(h[0]);isNaN(l)?l=0:(l=Math.max(0,l),l=Math.min(12,l));var c=parseInt(h[1]);isNaN(c)?c=0:(c=Math.max(0,c),c=Math.min(59,c)),s=60*l+c}else{var l=parseInt(a);isNaN(l)?l=0:(l=Math.max(0,l),l=Math.min(12,l)),s=60*l}}o&&(s=-s),i=n(s).getTime()}else i=(new Date).getTime();var u=new Date;return u.setTime(i),""==t||null==t?i:r(u,t)},SB4API.functions.saveToFile=function(t,e,i){t=_.isObject(t)?s.stringify(t):s.parseString(t),_.str.isBlank(i)&&(i="text/plain;charset=utf-8"),SB4API._EMBEDDED&&$.notify("saveToFile is not fully supported in authoring preview mode.","warn"),saveAs(new Blob([t]),e,{type:i})},SB4API.globalEventListenerMap={},SB4API.fireGlobalEvent=function(t,e){if(SB4API.rootContext){var i=SB4API.rootContext.get("[frame]"),s="flow";t="evt://"+t;var r={};r.broadcast=!1,r["[evtval]"]=e,r["[evt_ext_lesson]"]=!0;for(var n=0;n<i.engine.subEngines.length;n++)i.engine.subEngines[n].addEvent(s,t,r)}},SB4API.getGlobalVariable=function(t){var e=SB4API.rootContext.get("[frame]");return e.engine.objctx.get("global "+t)},SB4API.setGlobalVariable=function(t,e){var i=SB4API.rootContext.get("[frame]");return i.engine.objctx.add("global "+t,e)},SB4API.addGlobalEventListener=function(t,e){var i="flow.evt://"+t,s=SB4API.globalEventListenerMap[i];null==s?(s=[],s.push(e),SB4API.globalEventListenerMap[i]=s):s.push(e)},SB4API.removeGlobalEventListener=function(t,e){var i="flow.evt://"+t,s=SB4API.globalEventListenerMap[i];null!=s&&(SB4API.globalEventListenerMap[i]=_.without(s,e))},SB4API.onGlobalEventListener=function(t,e){var i=SB4API.globalEventListenerMap[t];i&&$.each(i,function(t,i){_.isFunction(i)&&i(e)})},SB4API.setAudioCapable=function(){if(SB4API.audioCapable===!1){var t,e=$(".audio-unused");e.length>0?(t=$(e[0]),t.removeClass("audio-unused"),t.addClass("audio-used")):t=$("<audio></audio>"),t.attr("muted","true");var i=function(e){SB4API.audioCapable=e,t.hasClass("audio-used")?(t.removeClass("audio-used"),t.addClass("audio-unused"),t.removeAttr("muted"),t.attr("src",""),t.attr("id",""),t.appendTo("#media"),t.off(),t.find("*").off()):t.remove()};t.on("ended",function(){i(!0)}),t.on("error",function(t){i(!1)}),t.appendTo("body"),t.attr("src",SB4API.addBustParam("app/empty.mp3")),t[0].play()}},SB4API.capabilities={},SB4API.capabilities.isAudioCapable=function(){return SB4API.audioCapable},t}),function(t){var e=document,i="appendChild",s="styleSheet",r=e.createElement("style");r.type="text/css",e.getElementsByTagName("head")[0][i](r),r[s]?r[s].cssText=t:r[i](e.createTextNode(t))}("div.com_smartbuilder_axon_widget_shape{}div.com_smartbuilder_axon_widget_text_richtext div p{margin-top:0;margin-bottom:0;}div.com_smartbuilder_axon_widget_text_richtext div ul{margin-top:0;margin-bottom:0;list-style-type:disc;}div.com_smartbuilder_axon_widget_text_richtext div ol{margin-top:0;margin-bottom:0;}div.com_smartbuilder_axon_widget_text_richtext div hr{height:0;margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #000;box-sizing:content-box;-webkit-box-sizing:content-box;-moz-box-sizing:content-box;}div.com_smartbuilder_axon_widget_image{width:auto;height:auto;}div.com_smartbuilder_axon_widget_button{}div.com_smartbuilder_axon_widget_button button{width:100%;height:100%;border:none;background-color:rgba(255,255,255,0);}div.com_smartbuilder_axon_widget_button button:focus{width:100%;height:100%;outline:solid 2px blue;#outline-offset:1px;background-color:rgba(255,255,0,0);}");