text: /*! V1.3.2, © INA 2016 */
  /**
   * Copyright (c) 2015 Institut National de l'Audiovisuel, INA
   * This file is part of amalia.js
  
   * amalia.js is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  
   * Redistributions of source code, javascript and css minified versions
   * must retain the above copyright notice, this list of conditions and the following disclaimer.
  
   * Neither the name of the copyright holder nor the names of its
   * contributors may be used to endorse or promote products derived from
   * this software without specific prior written permission.
  
   * You should have received a copy of the GNU General Public License
   * along with amalia.js. If not, see <http://www.gnu.org/licenses/>
  
   *
   * amalia.js is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   * GNU General Public License for more details.
   */
  
  fr.ina.amalia.player.plugins.PluginBase.extend("fr.ina.amalia.player.plugins.MetadataListEditorPlugin",{classCss:"ajs-plugin editor plugin-list-editor",eventTypes:{}},{container:null,loadDataStarted:!1,metadataManager:null,initialize:function(){this._super(),this.settings=$.extend({defaultDataType:"default",defaultAuthor:"amalia.js",defaultColor:"#2196f3",defaultShape:"circle"},this.settings.parameters||{}),this.container=$("<div>",{"class":this.Class.classCss}),this.pluginContainer.append(this.container),this.createHeaderElement(),this.createMetadataListBlock(),this.createFooterElement(),this.defineListeners(),this.metadataManager=this.mediaPlayer.getMetadataManager(),this.loaderContainer.show()},defineListeners:function(){var a=this.mediaPlayer.getContainer();a.on(fr.ina.amalia.player.PlayerEventType.SELECTED_METADATA_CHANGE,{self:this},this.onSelectedMetadataChange),a.on(fr.ina.amalia.player.PlayerEventType.BEGIN_DATA_CHANGE,{self:this},this.onBeginDataChange),a.on(fr.ina.amalia.player.PlayerEventType.DATA_CHANGE,{self:this},this.onDataChange),a.on(fr.ina.amalia.player.PlayerEventType.END_DATA_CHANGE,{self:this},this.onEndDataChange),null!==this.logger&&this.logger.trace(this.Class.fullName,"definePlayerListeners")},createHeaderElement:function(){var a=$("<div>",{"class":"heading"}),b=$("<h3>",{"class":"title",text:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_LIST_EDITOR_LABEL_HEADER});a.append(b),this.container.append(a)},createMetadataListBlock:function(){var a=$("<div>",{"class":"body"}),b=$("<ul>",{"class":"listOfmetadata"});a.append(b),this.container.append(a)},createFooterElement:function(){var a=$("<div>",{"class":"footer"}),b=$("<button>",{"class":"add-metadata ajs-icon ajs-icon-plus"}).on("click",{self:this},this.onAddMetadata);a.append(b),this.container.append(a)},updateMetadataListBlock:function(){var a=this.container.find("ul.listOfmetadata");a.empty();var b=this.mediaPlayer.getBlocksMetadata();if(null!==b)for(var c in b){var d=$("<li>",{"class":"item item-"+c,"data-metadata-id":c}),e=$("<span>",{"class":"text",text:c}),f=$("<span>",{"class":"delete ajs-icon ajs-icon-remove"}),g=$("<span>",{"class":"duplicate ajs-icon ajs-icon-reorder"});d.append(e),d.append(f),d.append(g),a.append(d)}a.find("li").on("click",{self:this},this.onSelectMetadata);var h=this.mediaPlayer.getSelectedMetadataId();a.find("li.item").removeClass("selected"),null!==h&&a.find("li.item.item-"+h).addClass("selected"),this.loaderContainer.hide()},setSelectedMetadataId:function(a){this.mediaPlayer.getSelectedMetadataId()!==a&&this.mediaPlayer.setSelectedMetadataId(a)},removeMetadataById:function(a){this.mediaPlayer.deleteAllMetadataById(a),this.updateMetadataListBlock()},duplicateBlock:function(a){var b="_"+fr.ina.amalia.player.helpers.UtilitiesHelper.generateUUID(),c=JSON.parse(JSON.stringify(this.mediaPlayer.getMetadataById(a))),d=this.metadataManager.getBlockMetadata(a);this.metadataManager.updateBlockMetadata(b,{id:b,label:b,type:d.hasOwnProperty("type")?d.type:this.settings.defaultDataType,author:d.hasOwnProperty("author")?d.type:this.settings.defaultAuthor,color:d.hasOwnProperty("color")?d.type:this.settings.defaultColor,shape:d.hasOwnProperty("shape")?d.type:this.settings.defaultShape}),this.mediaPlayer.setMetadataById(b,c),this.mediaPlayer.setSelectedMetadataId(b),this.updateMetadataListBlock()},onAddMetadata:function(a){var b="_"+fr.ina.amalia.player.helpers.UtilitiesHelper.generateUUID();a.data.self.metadataManager.updateBlockMetadata(b,{id:b,label:b,type:a.data.self.settings.defaultDataType,author:a.data.self.settings.defaultAuthor,color:a.data.self.settings.defaultColor,shape:a.data.self.settings.defaultShape}),a.data.self.mediaPlayer.addMetadataById(b,[]),a.data.self.mediaPlayer.setSelectedMetadataId(b),a.data.self.updateMetadataListBlock()},onSelectMetadata:function(a){var b=$(a.currentTarget).attr("data-metadata-id"),c=$(a.target);c.hasClass("delete")?a.data.self.removeMetadataById(b):c.hasClass("duplicate")?a.data.self.duplicateBlock(b):a.data.self.setSelectedMetadataId(b),null!==a.data.self.logger&&a.data.self.logger.trace(a.data.self.Class.fullName,"onSelectMetadata  : "+b)},onSelectedMetadataChange:function(a,b){if(a.data.self.container.find("ul.listOfmetadata .item").removeClass("selected"),null!==b.metadataId){a.data.self.container.find('ul.listOfmetadata [data-metadata-id="'+b.metadataId+'"]').addClass("selected");var c=a.data.self.container.find('ul.listOfmetadata [data-metadata-id="'+b.metadataId+'"]').offset();"object"==typeof c&&c.hasOwnProperty("top")&&a.data.self.container.find("ul.listOfmetadata").stop().animate({scrollTop:c.top},500,"easeInOutExpo")}},onBeginDataChange:function(a){a.data.self.loadDataStarted=!0,null!==a.data.self.logger&&a.data.self.logger.trace(a.data.self.Class.fullName,"onBeginDataChange")},onDataChange:function(a){a.data.self.loadDataStarted===!1&&a.data.self.updateMetadataListBlock()},onEndDataChange:function(a){a.data.self.loadDataStarted=!1,a.data.self.updateMetadataListBlock(),null!==a.data.self.logger&&a.data.self.logger.trace(a.data.self.Class.fullName,"EndDataChange")}}),fr.ina.amalia.player.plugins.PluginBase.extend("fr.ina.amalia.player.plugins.MetadataBlockEditorPlugin",{classCss:"ajs-plugin editor plugin-block-editor",eventTypes:{}},{container:null,loadDataStarted:!1,metadataManager:null,initialize:function(){this._super(),this.settings=$.extend({shapesListOfElements:["legal","facetime","circle"]},this.settings.parameters||{}),this.container=$("<div>",{"class":this.Class.classCss}),this.pluginContainer.append(this.container),this.createHeaderElement(),this.createMetadataBlock(),this.createFooterElement(),this.defineListeners(),this.metadataManager=this.mediaPlayer.getMetadataManager()},createHeaderElement:function(){var a=$("<div>",{"class":"heading"}),b=$("<h3>",{"class":"title",text:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_LABEL_HEADER});a.append(b),this.container.append(a)},createMetadataBlock:function(){var a=$("<div>",{"class":"body"}),b=$("<div>",{"class":"messages-container"});b.hide();var c=$("<form>",{"class":"formMetadataBlock"}),d=$("<div>",{"class":"form-item",text:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_FORM_LABEL_METADATA_ID}),e=$("<input>",{"class":"metadata-id input",name:"id",type:"text",disabled:"disabled",placeholder:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_FORM_LABEL_ID});d.append(e);var f=$("<div>",{"class":"form-item",text:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_FORM_LABEL_METADATA_LABAL}),g=$("<input>",{"class":"metadata-label input",name:"label",type:"text",placeholder:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_FORM_LABEL_METADATA_LABAL});f.append(g);var h=$("<div>",{"class":"form-item",text:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_FORM_LABEL_METADATA_TYPE}),i=$("<select>",{"class":"metadata-type select",name:"type"});h.append(i);var j=fr.ina.amalia.player.PluginBindingManager.dataTypes;for(var k in j){var l=$("<option>",{value:j[k].toString(),text:k.toString()});i.append(l)}var m=$("<div>",{"class":"form-item",text:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_FORM_LABEL_METADATA_DESCRIPTION}),n=$("<textarea>",{"class":"metadata-description text-area",name:"description",placeholder:"Description"});m.append(n);var o=$("<div>",{"class":"form-item",text:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_FORM_LABEL_METADATA_REFERENCE}),p=$("<input>",{"class":"metadata-ref input",name:"ref",type:"text",placeholder:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_FORM_LABEL_METADATA_REFERENCE});o.append(p);var q=$("<div>",{"class":"form-item",text:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_FORM_LABEL_METADATA_AUTHOR}),r=$("<input>",{"class":"metadata-author input",name:"author",type:"text",placeholder:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_FORM_LABEL_METADATA_AUTHOR});q.append(r);var s=$("<div>",{"class":"form-item",text:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_FORM_LABEL_METADATA_SHAPE}),t=$("<p>",{"class":"metadata-shape",placeholder:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_FORM_LABEL_METADATA_SHAPE});s.append(t);var u=this.settings.shapesListOfElements;for(var v in u){var w=$("<input>",{id:"shape-item-"+u[v].toString(),name:"shape",value:u[v].toString(),type:"radio"}),x=$("<label>",{"for":"shape-item-"+u[v].toString(),"class":"shape ajs-icon ajs-icon-"+u[v].toString()});t.append(w),t.append(x)}var y=$("<div>",{"class":"form-item",text:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_FORM_LABEL_METADATA_COLOR}),z=$("<input>",{"class":"metadata-color input",type:"color",name:"color",placeholder:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_BLOCK_EDITOR_FORM_LABEL_METADATA_COLOR});y.append(z),c.append(d),c.append(h),c.append(f),c.append(m),c.append(o),c.append(q),c.append(y),c.append(s),a.append(b),a.append(c),this.container.append(a)},createFooterElement:function(){var a=$("<div>",{"class":"footer"}),b=$("<button>",{"class":"save-metadata ajs-icon ajs-icon-check"}).on("click",{self:this},this.onSaveMetadata);a.append(b),this.container.append(a)},setMessage:function(a,b){if(b=b?b:"info","undefined"!=typeof a&&"undefined"!=typeof a.length){var c=this.container.find(".messages-container");c.empty().removeClass(function(a,b){return(b.match(/(^|\s)type-\S+/g)||[]).join(" ")}).addClass("type-"+b);for(var d=0;d<a.length;d++){var e=$("<p>",{"class":"error",text:a[d].toString()});c.append(e)}0!==a.length?c.show():c.hide()}},clearMessage:function(){this.container.find(".messages-container").empty().hide()},defineListeners:function(){var a=this.mediaPlayer.getContainer();a.on(fr.ina.amalia.player.PlayerEventType.SELECTED_METADATA_CHANGE,{self:this},this.onSelectedMetadataChange),null!==this.logger&&this.logger.trace(this.Class.fullName,"definePlayerListeners")},isValidForm:function(a){if("undefined"!=typeof a&&"undefined"!=typeof a.length){var b=this.container.find(".formMetadataBlock");return""===b.find('[name="id"]').val()?a.push("Id is required field"):""===b.find('[name="label"]').val()?a.push("Label is required field"):""===b.find('[name="type"]').val()&&a.push("Type is required field"),0===a.length}return!1},updateMetadata:function(a){var b=this.metadataManager.getBlockMetadata(a),c=b.hasOwnProperty("viewControl")&&null!==b.viewControl?b.viewControl:null,d=null!==c&&c.hasOwnProperty("shape")&&""!==c.shape?c.shape:"circle",e=null!==c&&c.hasOwnProperty("color")&&""!==c.color?c.color:"#3cf",f=this.container.find(".formMetadataBlock");null!==b?(f.find('[name="label"]').val(b.hasOwnProperty("label")?b.label:""),f.find('[name="type"] option[value="'+b.type+'"]').prop("selected",!0),""===b.type||b.type===fr.ina.amalia.player.PluginBindingManager.dataTypes.DEFAULT?f.find('[name="type"]').prop("disabled",!1):f.find('[name="type"]').prop("disabled",!0),f.find('[name="description"]').val(b.hasOwnProperty("description")?b.description:""),f.find('[name="ref"]').val(b.hasOwnProperty("ref")?b.ref:""),f.find('[name="author"]').val(b.hasOwnProperty("author")?b.author:""),f.find('[name="color"]').val(e),f.find('[name="shape"]').first().prop("checked",!0),f.find('[name="shape"][value="'+d+'"]').prop("checked",!0)):(f.find('[name="label"]').val(""),f.find('[name="type"] option').prop("selected",!1),f.find('[name="type"]').prop("disabled",!1),f.find('[name="description"]').val(""),f.find('[name="ref"]').val(""),f.find('[name="author"]').val(""),f.find('[name="color"]').val(""),f.find('[name="shape"]').first().prop("checked",!0)),this.container.find("form.formMetadataBlock .form-item .metadata-id").val(a),this.clearMessage()},saveMetadata:function(){var a=this.container.find(".formMetadataBlock"),b=[];if(this.isValidForm(b)){var c=a.find('[name="id"]').val();this.metadataManager.updateBlockMetadata(c,{id:c,label:fr.ina.amalia.player.helpers.UtilitiesHelper.htmlEscape(a.find('[name="label"]').val()),type:a.find('[name="type"]').val(),description:fr.ina.amalia.player.helpers.UtilitiesHelper.htmlEscape(a.find('[name="description"]').val()),ref:fr.ina.amalia.player.helpers.UtilitiesHelper.htmlEscape(a.find('[name="ref"]').val()),author:fr.ina.amalia.player.helpers.UtilitiesHelper.htmlEscape(a.find('[name="author"]').val()),viewControl:{color:fr.ina.amalia.player.helpers.UtilitiesHelper.htmlEscape(a.find('[name="color"]').val()),shape:fr.ina.amalia.player.helpers.UtilitiesHelper.htmlEscape(a.find('[name="shape"]:checked').val())}}),this.updateMetadata(c),this.setMessage(["Saved!"],"info")}else this.setMessage(b,"error")},onSelectedMetadataChange:function(a,b){null!==b.metadataId&&a.data.self.updateMetadata(b.metadataId)},onSaveMetadata:function(a){a.data.self.saveMetadata()}}),fr.ina.amalia.player.plugins.PluginBase.extend("fr.ina.amalia.player.plugins.MetadataItemsEditorPlugin",{classCss:"ajs-plugin editor plugin-items-editor"},{tcin:0,tcout:0,container:null,loadDataStarted:!1,metadataManager:null,metadataId:null,localisationManager:null,initialize:function(){this._super(),this.settings=$.extend({defaultPercentWidth:.1},this.settings.parameters||{}),this.container=$("<div>",{"class":this.Class.classCss}),this.tcin=this.mediaPlayer.getTcOffset(),this.tcout=this.mediaPlayer.getDuration()+this.mediaPlayer.getTcOffset(),this.pluginContainer.append(this.container),this.createHeaderElement(),this.createMetadataItemsBlock(),this.createFooterElement(),this.defineListeners(),this.metadataManager=this.mediaPlayer.getMetadataManager(),this.localisationManager=new fr.ina.amalia.player.LocalisationManager},createHeaderElement:function(){var a=$("<div>",{"class":"heading"}),b=$("<h3>",{"class":"title",text:fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_ITEMS_EDITOR_LABEL_HEADER});a.append(b),this.container.append(a)},createMetadataItemsBlock:function(){var a=$("<div>",{"class":"body"}),b=$("<div>",{"class":"messages-container"}).hide(),c=$("<ul>",{"class":"listOfSelectedItems"});a.append(b),a.append(c),this.container.append(a)},createFooterElement:function(){var a=$("<div>",{"class":"footer"}),b=$("<span>",{"class":"button add ajs-icon ajs-icon-plus"}).on("click",{self:this},this.onAddItem),c=$("<span>",{"class":"button validateAll ajs-icon ajs-icon-check"}).on("click",{self:this},this.onValidateItems),d=$("<span>",{"class":"button clear ajs-icon ajs-icon-eject"}).on("click",{self:this},this.onClearItems);a.append(b),a.append(c),a.append(d),this.container.append(a)},setMessage:function(a,b){if(b=b?b:"info","undefined"!=typeof a&&"undefined"!=typeof a.length){var c=this.container.find(".messages-container");c.empty().removeClass(function(a,b){return(b.match(/(^|\s)type-\S+/g)||[]).join(" ")}).addClass("type-"+b);for(var d=0;d<a.length;d++){var e=$("<p>",{"class":"error",text:a[d].toString()});c.append(e)}0!==a.length?c.show():c.hide()}},clearMessage:function(){var a=this.container.find(".messages-container");a.empty().hide()},defineListeners:function(){var a=this.mediaPlayer.getContainer();a.on(fr.ina.amalia.player.PlayerEventType.SELECTED_METADATA_CHANGE,{self:this},this.onSelectedMetadataChange),a.on(fr.ina.amalia.player.PlayerEventType.SELECTED_ITEMS_CHANGE,{self:this},this.onSelectedItemsChange),a.on(fr.ina.amalia.player.PlayerEventType.DATA_CHANGE,{self:this},this.onDataChange),null!==this.logger&&this.logger.trace(this.Class.fullName,"definePlayerListeners")},createFormData:function(a){var b=$("<form>",{"class":"form-data"}).data("metadata",a),c=$("<div>",{"class":"form-input"}),d=$("<span>",{"class":"text data-model-label","data-label":"",text:a.hasOwnProperty("label")?a.label:""}),e=$("<input>",{name:"label","class":"input data-model-label",value:a.hasOwnProperty("label")?a.label:"",placeholder:"Label"}).hide();if(c.append(d),c.append(e),b.append(c),a.hasOwnProperty("tcout")){var f=$("<div>",{"class":"form-input"}),g=$("<span>",{"class":"text  data-model-tcin","data-label":"Tc-in: ",text:a.hasOwnProperty("tcin")?"Tc-in: "+fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(a.tcin,"ms"):""}),h=$("<input>",{name:"tcin","class":"input  data-model-tcin",value:a.hasOwnProperty("tcin")?fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(a.tcin,"ms"):"",placeholder:"TC-IN"}).hide();f.append(g),f.append(h),b.append(f);var i=$("<div>",{"class":"form-input"}),j=$("<span>",{"class":"text data-model-tcout","data-label":"Tc-out: ",text:a.hasOwnProperty("tcout")?"Tc-out: "+fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(a.tcout,"ms"):""}),k=$("<input>",{name:"tcout","class":"input data-model-tcout",value:a.hasOwnProperty("tcout")?fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(a.tcout,"ms"):"",placeholder:"TC-OUT"}).hide();i.append(j),i.append(k),b.append(i)}else{var l="number"==typeof a.tc?a.tc:fr.ina.amalia.player.helpers.UtilitiesHelper.convertHourToSeconde(a.tc),m=$("<div>",{"class":"form-input"}),n=$("<span>",{"class":"text data-model-tc","data-label":"Tc: ",text:a.hasOwnProperty("tc")?"Tc: "+fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(l,"ms"):""}),o=$("<input>",{name:"tc","class":"input data-model-tc",value:a.hasOwnProperty("tc")?fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(l,"ms"):"",placeholder:"TC"}).hide();m.append(n),m.append(o),b.append(m)}var p=$("<div>",{"class":"form-controls"}),q=$("<span>",{"class":"button valid ajs-icon ajs-icon-check"}),r=$("<span>",{"class":"button remove ajs-icon ajs-icon-eraser"}),s=$("<span>",{"class":"button close ajs-icon ajs-icon-eject"});return p.append(q),p.append(r),p.append(s),b.append(p),b},updateSelectedItems:function(){var a=this.container.find("ul.listOfSelectedItems"),b=this.mediaPlayer.getSelectedItems(),c=a.find("li.item").last(),d=c.length>0?parseInt(c.attr("class").match(/item-([0-9]+)/)[1])+1:0;if(d=isNaN(d)?0:d,"undefined"!=typeof b&&b.hasOwnProperty("length")&&b.length>0)for(var e=0;e<b.length;e++){var f=b[e],g=null!==f&&f.hasOwnProperty("formCreated")?f.formCreated===!1:!0;if(null!==f&&g){var h=this.createFormData(f),i=$("<li>",{"class":"item item-"+e});f.formCreated=!0,i.append(h),a.append(i)}}a.find(".form-input").on("click",{self:this},this.onFormEdit),a.find(".form-input input.input").on("focusout",{self:this},this.onFormFocusout),a.find(".form-data .form-controls .button.valid").on("click",{self:this},this.onSaveForm),a.find(".form-data .form-controls .button.remove").on("click",{self:this},this.onDeleteItem),a.find(".form-data .form-controls .button.close").on("click",{self:this},this.onCloseForm)},_closeItem:function(a){var b=a.find("form").first(),c=b.data("metadata");c.selected=!1,c.formCreated=!1,a.remove()},_validateItem:function(a){var b=parseInt(a.attr("class").match(/item-([0-9]+)/)[1]),c=a.find("form").first(),d=c.data("metadata"),e=/^[0-9]{2}:[0-9]{2}:[0-9]{2}.[0-9]{2}$/,f=!1;return e.test(c.find('[name="tc"]').val())?f=!0:"undefined"!=typeof c.find('[name="tcin"]').val()&&"undefined"!=typeof c.find('[name="tcout"]').val()&&(f=e.test(c.find('[name="tcin"]').val())&&e.test(c.find('[name="tcout"]').val())?!0:!1),d.tc=fr.ina.amalia.player.helpers.UtilitiesHelper.convertHourToSeconde(c.find('[name="tc"]').val()),this.validItemTcRange(d,d.tc)?f=!0:d.hasOwnProperty("tcRange")&&(f=!1),f&&("undefined"!=typeof c.find('[name="tcout"]').val()&&(d.tcin=fr.ina.amalia.player.helpers.UtilitiesHelper.convertHourToSeconde(c.find('[name="tcin"]').val()),d.tcout=fr.ina.amalia.player.helpers.UtilitiesHelper.convertHourToSeconde(c.find('[name="tcout"]').val())),d.label=fr.ina.amalia.player.helpers.UtilitiesHelper.htmlEscape(c.find('[name="label"]').val()),d.selected=!1,d.formCreated=!1,a.remove(),this.metadataManager.removeSelectedItem(b)),f},validItemTcRange:function(a,b){var c=!1;return null!==a&&"object"==typeof a&&a.hasOwnProperty("tcRange")&&(a.tcRange.hasOwnProperty("min")&&a.tcRange.hasOwnProperty("max")?c=b>a.tcRange.min&&b<a.tcRange.max:a.tcRange.hasOwnProperty("min")?c=b>a.tcRange.min&&b<=this.tcout:a.tcRange.hasOwnProperty("max")&&(c=b>=this.tcin&&b<a.tcRange.max)),c},updateFormItems:function(){for(var a=this.container.find("ul.listOfSelectedItems li.item"),b=0;b<a.length;b++){var c=$(a[b]).find("form.form-data").data("metadata");"object"==typeof c&&c.hasOwnProperty("selected")&&c.selected===!0?$.each($(a[b]).find(".form-data"),this.updateFormItem):"object"==typeof c&&c.hasOwnProperty("selected")&&c.selected===!1&&this._closeItem($(a[b]))}},updateFormItem:function(a,b){var c=$(b),d=c.data("metadata");d.hasOwnProperty("label")&&(c.find("span.data-model-label").html(d.label),c.find("input.data-model-label").val(d.label)),d.hasOwnProperty("tc")&&(c.find("span.data-model-tc").html(c.find("span.data-model-tc").attr("data-label")+fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(d.tc,"ms")),c.find("input.data-model-tc").val(fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(d.tc,"ms"))),d.hasOwnProperty("tcin")&&(c.find("span.data-model-tcin").html(c.find("span.data-model-tcin").attr("data-label")+fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(d.tcin,"ms")),c.find("input.data-model-tcin").val(fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(d.tcin,"ms"))),d.hasOwnProperty("tcout")&&(c.find("span.data-model-tcout").html(c.find("span.data-model-tcout").attr("data-label")+fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(d.tcout,"ms")),c.find("input.data-model-tcout").val(fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(d.tcout,"ms")))},onFormEdit:function(a){var b=$(a.currentTarget);b.find(".text").html("").hide(),b.find("input").show().focus()},onFormFocusout:function(a){var b=$(a.target),c=b.parent().find(".text");c.text(c.attr("data-label")+b.val()).show(),b.parents("li.item").find(".button.valid").addClass("on"),b.hide()},onSaveForm:function(a){var b=a.data.self._validateItem($(a.currentTarget).parents("li.item").first(),a.data.self.metadataId);b?a.data.self.mediaPlayer.getContainer().trigger(fr.ina.amalia.player.PlayerEventType.DATA_CHANGE,{id:a.data.self.metadataId}):$(a.currentTarget).parents("li.item").first().addClass("error")},onCloseForm:function(a){a.data.self._closeItem($(a.currentTarget).parents("li.item").first()),a.data.self.mediaPlayer.getContainer().trigger(fr.ina.amalia.player.PlayerEventType.DATA_CHANGE,{id:a.data.self.metadataId})},onDeleteItem:function(a){var b=$(a.currentTarget).parents("li.item").first(),c=parseInt(b.attr("class").match(/item-([0-9]+)/)[1]),d=b.find("form").first(),e=d.data("metadata");if(e.tc=null,e.tcin=null,e.tcout=null,e.label=null,e.selected=!1,e.formCreated=!1,a.data.self.metadataManager.removeSelectedItem(c),b.remove(),e.deleted=!0,e.hasOwnProperty("subItem")&&e.subItem===!0){var f=a.data.self.mediaPlayer.getMetadataById(a.data.self.metadataId);a.data.self.localisationManager.updateSpacialLocBlock(f)}b.remove(),a.data.self.mediaPlayer.getContainer().trigger(fr.ina.amalia.player.PlayerEventType.DATA_CHANGE,{id:a.data.self.metadataId})},onSelectedMetadataChange:function(a,b){for(var c=a.data.self.container.find("ul.listOfSelectedItems li.item"),d=0;d<c.length;d++)a.data.self._closeItem($(c[d]));a.data.self.metadataId=null!==b.metadataId?b.metadataId.toString():null,a.data.self.clearMessage()},onAddItem:function(a){if(null!==a.data.self.metadataId&&""!==a.data.self.metadataId){var b=null,c="";if(null!==a.data.self.metadataId){var d=a.data.self.mediaPlayer.getBlockMetadata(a.data.self.metadataId),e=null!==d&&d.hasOwnProperty("type")?d.type:"";c=a.data.self.bindingManager.getLinetypeWithDataType(e)}switch(c){case fr.ina.amalia.player.PluginBindingManager.pluginTypes.TIMELINE_SEGMENT:b=[{tcin:a.data.self.mediaPlayer.getCurrentTime(),tcout:Math.min(a.data.self.mediaPlayer.getCurrentTime()+a.data.self.mediaPlayer.getDuration()*Math.min(a.data.self.settings.defaultPercentWidth,1),a.data.self.mediaPlayer.getDuration()),label:"New segment",tclevel:1,selected:!0,formCreated:!1}],a.data.self.mediaPlayer.addMetadataById(a.data.self.metadataId,b),a.data.self.clearMessage();break;case fr.ina.amalia.player.PluginBindingManager.pluginTypes.TIMELINE_IMAGE:b=[{tc:a.data.self.mediaPlayer.getCurrentTime(),label:"New Point",tclevel:1,selected:!0,formCreated:!1}],a.data.self.mediaPlayer.addMetadataById(a.data.self.metadataId,b),a.data.self.clearMessage();break;case fr.ina.amalia.player.PluginBindingManager.pluginTypes.TIMELINE_CUEPOINT:b=[{tc:a.data.self.mediaPlayer.getCurrentTime(),label:"New Point",tclevel:1,selected:!0,formCreated:!1}],a.data.self.mediaPlayer.addMetadataById(a.data.self.metadataId,b),a.data.self.clearMessage();break;default:a.data.self.setMessage([fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_ITEMS_EDITOR_NEED_METADTA_ITEM_TYPE],"error")}}else a.data.self.setMessage([fr.ina.amalia.player.PlayerMessage.PLUGIN_METADATA_ITEMS_EDITOR_NEED_METADTA],"error")},onClearItems:function(a){for(var b=a.data.self.container.find("ul.listOfSelectedItems li.item"),c=0;c<b.length;c++)a.data.self._closeItem($(b[c]));a.data.self.mediaPlayer.getContainer().trigger(fr.ina.amalia.player.PlayerEventType.DATA_CHANGE,{id:a.data.self.metadataId})},onValidateItems:function(a){for(var b=a.data.self.container.find("ul.listOfSelectedItems li.item"),c=0;c<b.length;c++){var d=a.data.self._validateItem($(b[c]));d||$(b[c]).addClass("error")}a.data.self.mediaPlayer.getContainer().trigger(fr.ina.amalia.player.PlayerEventType.DATA_CHANGE,{id:a.data.self.metadataId})},onDataChange:function(a,b){b.id===a.data.self.metadataId&&a.data.self.updateFormItems()},onSelectedItemsChange:function(a){null!==a.data.self.metadataId&&""!==a.data.self.metadataId&&(a.data.self.updateFormItems(),a.data.self.updateSelectedItems()),null!==a.data.self.logger&&a.data.self.logger.trace(a.data.self.Class.fullName,"EndDataChange")}}),fr.ina.amalia.player.plugins.PluginBase.extend("fr.ina.amalia.player.plugins.MetadataItemEditorPlugin",{classCss:"ajs-plugin plugin-selected-item-editor",addSegmentIcon:"ajs-icon ajs-icon-add-whole-segment",msgAddSegment:"AJOUTER UN SEGMENT INTEGRALE",msgValid:"Créer un élément",msgEdit:"Modifier l'élément"},{container:null,metadataId:null,selectedItem:null,initialize:function(){this.metadataId=null,this.selectedItem=null,this._super(),this.settings=$.extend({timeFormat:"f",framerate:this.settings.framerate,defaultPercentWidth:.1},this.settings.parameters||{}),this.container=$("<div>",{"class":this.Class.classCss}),this.pluginContainer.append(this.container),this.createAutoFillUpForm(),this.createFormContainer(),this.defineListeners()},createFormItem:function(a,b,c){var d=$("<div>",{"class":"form-item "+a}),e=$("<input>",{"class":"form-item-"+a,type:c,placeholder:b});return d.append(e),d},createControl:function(a,b){var c=$("<div>",{"class":"form-item ctrl "+a}),d=$("<button>",{"class":"form-ctrl-item-"+a,text:b});return c.append(d),c},createAutoFillUpForm:function(){var a=$("<div>",{"class":"auto-fill-up-form"}),b=$("<div>",{"class":"message",text:this.Class.msgAddSegment});a.append(b),a.append(this.createControl("yes","Oui")),a.append(this.createControl("no","NON")),this.container.append(a)},createFormContainer:function(){var a=$("<div>",{"class":"form"});a.append(this.createFormItem("label","Titre","text")),a.append(this.createControl("tcin","TC-IN")),a.append(this.createFormItem("tcin","00:00:00:00","text")),a.append(this.createControl("tcout","TC-OUT")),a.append(this.createFormItem("tcout","00:00:00:00","text")),a.append(this.createControl("valid",this.Class.msgValid)),a.append(this.createControl("delete","Supprimer")),a.append(this.createControl("close-item","Annuler"));var b=this.createControl("auto-fill-up","");b.find("button").addClass(this.Class.addSegmentIcon),a.append(b),this.container.append(a)},defineListeners:function(){this.container.find(".form .form-item .form-ctrl-item-auto-fill-up").on("click",{self:this},this.onClickOpenAutoCompletForm),this.container.find(".auto-fill-up-form .form-ctrl-item-no").on("click",{self:this},this.onClickCloseAutoCompletForm),this.container.find(".auto-fill-up-form .form-ctrl-item-yes").on("click",{self:this},this.onClickAutoCompletForm),this.container.find(".form .form-ctrl-item-tcin").on("click",{self:this},this.onClickToTcin),this.container.find(".form .form-ctrl-item-tcout").on("click",{self:this},this.onClickToTcout),this.container.find(".form .form-item-tcin").on("keyup",{self:this},this.onFormValuesChange),this.container.find(".form .form-item-tcin").on("change",{self:this},this.onFormValuesChange),this.container.find(".form .form-item-tcout").on("keyup",{self:this},this.onFormValuesChange),this.container.find(".form .form-item-tcout").on("change",{self:this},this.onFormValuesChange),this.container.find(".form .form-item .form-ctrl-item-valid").on("click",{self:this},this.onFormValid),this.container.find(".form .form-item .form-ctrl-item-delete").on("click",{self:this},this.onDeleteItem),this.container.find(".form .form-item .form-ctrl-item-close-item").on("click",{self:this},this.onCloseItem);var a=this.mediaPlayer.getContainer();a.on(fr.ina.amalia.player.PlayerEventType.DATA_CHANGE,{self:this},this.onDataChange),a.on(fr.ina.amalia.player.PlayerEventType.SELECTED_ITEMS_CHANGE,{self:this},this.onSelectedItemsChange),a.on(fr.ina.amalia.player.PlayerEventType.SELECTED_METADATA_CHANGE,{self:this},this.onSelectedMetadataChange),null!==this.logger&&this.logger.trace(this.Class.fullName,"definePlayerListeners")},addItem:function(){if(null!==this.metadataId){var a=this.container.find(".form input.form-item-label").val(),b=this.container.find(".form input.form-item-tcin").val(),c=this.container.find(".form input.form-item-tcout").val();if(null===this.selectedItem){var d=[{tcin:fr.ina.amalia.player.helpers.UtilitiesHelper.convertTimeFPSToSeconde(b),tcout:fr.ina.amalia.player.helpers.UtilitiesHelper.convertTimeFPSToSeconde(c),label:""===a?this.getLabel():a}];this.mediaPlayer.addMetadataById(this.metadataId,d),this.clearSelectedData()}else null!==this.selectedItem&&this.selectedItem.hasOwnProperty("label")&&this.selectedItem.hasOwnProperty("tcin")&&this.selectedItem.hasOwnProperty("tcout")&&(this.selectedItem.label=""===a?this.getLabel():a,this.selectedItem.tcin=fr.ina.amalia.player.helpers.UtilitiesHelper.convertTimeFPSToSeconde(b),this.selectedItem.tcout=fr.ina.amalia.player.helpers.UtilitiesHelper.convertTimeFPSToSeconde(c),this.clearSelectedData(),this.mediaPlayer.getContainer().trigger(fr.ina.amalia.player.PlayerEventType.DATA_CHANGE,{id:this.metadataId}));this.container.find(".form").removeClass("edit-mode")}},getLabel:function(){var a="",b=this.mediaPlayer.getBlockMetadata(this.metadataId),c=$(this.mediaPlayer.getMetadataById(this.metadataId)).size();return null!==b&&b.hasOwnProperty("label")&&(a=b.label+" - "+c),a},addItemAuto:function(){if(null!==this.metadataId){var a=[{tcin:this.mediaPlayer.getTcin(),tcout:this.mediaPlayer.getTcout(),label:this.getLabel()}];return this.mediaPlayer.addMetadataById(this.metadataId,a),this.clearSelectedData(),!0}return!1},clearSelectedData:function(){null!==this.selectedItem&&this.selectedItem.hasOwnProperty("selected")&&(this.selectedItem.selected=!1),this.selectedItem=null,this.container.find(".form").removeClass("edit-mode"),this.container.find(".form input.form-item-label").val(""),this.container.find(".form input.form-item-tcin").val(""),this.container.find(".form input.form-item-tcout").val(""),this.container.find(".form .form-item .form-ctrl-item-delete").removeClass("on"),this.container.find(".form .form-item .form-ctrl-item-close-item").removeClass("on"),this.container.find(".form .form-item .form-ctrl-item-valid").text(this.Class.msgValid),this.container.find(".form .form-item .form-ctrl-item-valid").removeClass("valid"),this.container.find(".form").removeClass("valid"),this.container.find(".form input.form-item-tcout").removeClass("error").removeClass("valid"),this.container.find(".form input.form-item-tcin").removeClass("error").removeClass("valid")},validFormItems:function(){var a=!0,b=/^[0-9]{2}:[0-9]{2}:[0-9]{2}:[0-9]{2}$/,c=this.container.find(".form input.form-item-tcin").val(),d=this.container.find(".form input.form-item-tcout").val();
  return b.test(c)!==!0?(this.container.find(".form input.form-item-tcin").addClass("error").removeClass("valid"),a=!1):this.container.find(".form input.form-item-tcin").removeClass("error").addClass("valid"),b.test(d)!==!0?(this.container.find(".form input.form-item-tcout").addClass("error").removeClass("valid"),a=!1):this.container.find(".form input.form-item-tcout").removeClass("error").addClass("valid"),fr.ina.amalia.player.helpers.UtilitiesHelper.convertTimeFPSToSeconde(c)>=fr.ina.amalia.player.helpers.UtilitiesHelper.convertTimeFPSToSeconde(d)&&(this.container.find(".form input.form-item-tcin").addClass("error"),this.container.find(".form input.form-item-tcout").addClass("error"),a=!1),null===this.selectedItem?(this.container.find(".form .form-item .form-ctrl-item-delete").removeClass("on"),this.container.find(".form .form-item .form-ctrl-item-close-item").removeClass("on"),this.container.find(".form .form-item .form-ctrl-item-valid").text(this.Class.msgValid)):(this.container.find(".form .form-item .form-ctrl-item-delete").addClass("on"),this.container.find(".form .form-item .form-ctrl-item-close-item").addClass("on"),this.container.find(".form .form-item .form-ctrl-item-valid").text(this.Class.msgEdit)),a?(this.container.find(".form .form-item .form-ctrl-item-valid").addClass("valid"),this.container.find(".form").addClass("valid")):(this.container.find(".form .form-item .form-ctrl-item-valid").removeClass("valid"),this.container.find(".form").removeClass("valid")),a},setTcin:function(){if(this.container.find(".form input.form-item-tcin").val(fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(this.mediaPlayer.getCurrentTime(),this.settings.framerate,this.settings.timeFormat)),""===this.container.find(".form input.form-item-tcout").val()){var a=Math.min(this.mediaPlayer.getCurrentTime()+this.mediaPlayer.getDuration()*Math.min(this.settings.defaultPercentWidth,1),this.mediaPlayer.getDuration());this.container.find(".form input.form-item-tcout").val(fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(a,this.settings.framerate,this.settings.timeFormat)),this.validFormItems(),this.container.find(".form input.form-item-tcout").removeClass("error").removeClass("valid")}else this.validFormItems()},setTcout:function(){this.container.find(".form input.form-item-tcout").val(fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(this.mediaPlayer.getCurrentTime(),this.settings.framerate,this.settings.timeFormat)),this.validFormItems()},validForm:function(){this.validFormItems()&&this.addItem()},onFormValuesChange:function(a){a.data.self.validFormItems()},onClickToTcin:function(a){a.data.self.setTcin()},onClickToTcout:function(a){a.data.self.setTcout()},onSelectedItemsChange:function(a,b){a.data.self.selectedItem="undefined"!=typeof b&&b.hasOwnProperty("item")?b.item:null,null!==a.data.self.selectedItem&&a.data.self.selectedItem.selected===!1?(a.data.self.selectedItem=null,a.data.self.clearSelectedData()):null!==a.data.self.selectedItem&&a.data.self.selectedItem.hasOwnProperty("label")&&a.data.self.selectedItem.hasOwnProperty("tcin")&&a.data.self.selectedItem.hasOwnProperty("tcout")&&(a.data.self.container.find(".form").addClass("edit-mode"),a.data.self.container.find(".form input.form-item-label").val(a.data.self.selectedItem.label),a.data.self.container.find(".form input.form-item-tcin").val(fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(a.data.self.selectedItem.tcin,a.data.self.settings.framerate,a.data.self.settings.timeFormat)),a.data.self.container.find(".form input.form-item-tcout").val(fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(a.data.self.selectedItem.tcout,a.data.self.settings.framerate,a.data.self.settings.timeFormat)),a.data.self.validFormItems()),null!==a.data.self.logger&&a.data.self.logger.trace(a.data.self.Class.fullName,"onSelectedItemsChange")},onDataChange:function(a){null!==a.data.self.selectedItem&&a.data.self.selectedItem.hasOwnProperty("label")&&a.data.self.selectedItem.hasOwnProperty("tcin")&&a.data.self.selectedItem.hasOwnProperty("tcout")&&(a.data.self.container.find(".form input.form-item-label").val(a.data.self.selectedItem.label),a.data.self.container.find(".form input.form-item-tcin").val(fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(a.data.self.selectedItem.tcin,a.data.self.settings.framerate,"f")),a.data.self.container.find(".form input.form-item-tcout").val(fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(a.data.self.selectedItem.tcout,a.data.self.settings.framerate,"f")),a.data.self.validFormItems()),null!==a.data.self.logger&&a.data.self.logger.trace(a.data.self.Class.fullName,"onSelectedItemsChange")},onSelectedMetadataChange:function(a,b){a.data.self.mediaPlayer.removeAllSelectedItems(),a.data.self.metadataId=null!==b.metadataId?b.metadataId.toString():null},onClickOpenAutoCompletForm:function(a){a.data.self.container.find(".auto-fill-up-form").addClass("on")},onClickCloseAutoCompletForm:function(a){a.data.self.container.find(".auto-fill-up-form").removeClass("on")},onClickAutoCompletForm:function(a){a.data.self.addItemAuto(),a.data.self.container.find(".auto-fill-up-form").removeClass("on")},onFormValid:function(a){a.data.self.validForm()},onDeleteItem:function(a){a.data.self.selectedItem.tc=null,a.data.self.selectedItem.tcin=null,a.data.self.selectedItem.tcout=null,a.data.self.selectedItem.label=null,a.data.self.selectedItem.selected=!1,a.data.self.selectedItem.formCreated=!1,a.data.self.selectedItem.deleted=!0,a.data.self.selectedItem=null,a.data.self.clearSelectedData(),a.data.self.mediaPlayer.getContainer().trigger(fr.ina.amalia.player.PlayerEventType.DATA_CHANGE,{id:a.data.self.metadataId})},onCloseItem:function(a){a.data.self.selectedItem=null,a.data.self.mediaPlayer.removeAllSelectedItems(),a.data.self.mediaPlayer.getContainer().trigger(fr.ina.amalia.player.PlayerEventType.DATA_CHANGE,{id:a.data.self.metadataId}),a.data.self.clearSelectedData()}}),fr.ina.amalia.player.plugins.PluginBase.extend("fr.ina.amalia.player.plugins.MetadataItemsRefEditorPlugin",{classCss:"ajs-plugin plugin-items-ref-editor",classCssForThumbCapture:"ajs-icon ajs-icon-screenshot",classCssEditForm:"ajs-icon ajs-icon-check",LABEL_DESCRIPTION:"Description"},{container:null,metadataId:null,selectedItem:null,localisationManager:null,initialize:function(){this.metadataId=null,this.selectedItem=null,this._super(),this.settings=$.extend({defaultPercentWidth:.1,timeFormat:"f",framerate:this.settings.framerate},this.settings.parameters||{}),this.container=$("<div>",{"class":this.Class.classCss}),this.localisationManager=new fr.ina.amalia.player.LocalisationManager,this.pluginContainer.append(this.container),this.createMetadataItemsBlock(),this.defineListeners()},createMetadataItemsBlock:function(){var a=$("<div>",{"class":"heading off"});a.append("<p class='title'></p>");var b=$("<div>",{"class":"body"}),c=$("<div>",{"class":"messages-container"}).hide(),d=$("<ul>",{"class":"listOfSelectedItems"});b.append(a),b.append(c),b.append(d),this.container.append(b)},createItem:function(a){var b=$("<li>",{"class":"item"}).data("metadata",a),c=$("<div>",{"class":"thumb"}),d=$("<span>",{"class":"capture "+this.Class.classCssForThumbCapture});a.hasOwnProperty("thumb")&&null!==a.thumb&&""!==a.thumb&&c.css("background-image","url("+a.thumb+")"),c.append(d),b.append(c);var e=$("<span>",{"class":"text",text:a.hasOwnProperty("label")?a.label:""});b.append(e);var f=$("<span>",{"class":"tcin",text:a.hasOwnProperty("tcin")?fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(a.tcin,this.settings.framerate,this.settings.timeFormat):""});b.append(f);var g=$("<span>",{"class":"tcout",text:a.hasOwnProperty("tcout")?fr.ina.amalia.player.helpers.UtilitiesHelper.formatTime(a.tcout,this.settings.framerate,this.settings.timeFormat):""});b.append(g),b.append("<div style='clear: both;'></div>");var h=$("<div>",{"class":"edit-form"}),i=$("<p>",{"class":"text-element"}),j=$("<label>",{"class":"text-label",text:this.Class.LABEL_DESCRIPTION}),k=null!==a&&a.hasOwnProperty("data")&&null!==a.data&&a.data.hasOwnProperty("text")&&null!==a.data.text?a.data.text.join("\n"):"",l=$("<textarea>",{"class":"text-element",text:k});i.append(j),i.append(l),h.append(i),l.one("keydown",function(){b.addClass("change")});var m=$("<div>",{"class":"actions-list"}),n=$("<button>",{"class":"save "+this.Class.classCssEditForm});return m.append(n),h.append(m),b.append(h),b},updataFormHeader:function(){var a=this.mediaPlayer.getBlockMetadata(this.metadataId);null!==a&&"object"==typeof a&&a.hasOwnProperty("label")?(this.container.find("div.heading").removeClass("off").addClass("on"),this.container.find("div.heading p.title").html(a.label)):this.container.find("div.heading").removeClass("on").addClass("off")},updateFormItems:function(){var a=this.container.find("ul.listOfSelectedItems");a.empty(),this.localisationManager.updateLocBlock(this.mediaPlayer.getMetadataById(this.metadataId));var b=this.mediaPlayer.getMetadataById(this.metadataId);if(null!==b){for(var c=0;c<b.length;c++){var d=b[c];null!==d&&d.hasOwnProperty("tcin")&&d.tcin>=this.mediaPlayer.getTcOffset()&&a.append(this.createItem(d))}a.find("li.item .thumb .capture").on("click",{self:this},this.onClickToCapture),a.find("li.item").on("click",{self:this},this.onSelectItem),a.find("li.item .edit-form .save").on("click",{self:this},this.onSaveItem)}},updateCaptureImage:function(a){var b=this.mediaPlayer.getCurrentImage(),c=a.data("metadata");"undefined"!=typeof c&&(c.thumb=b,a.find(".thumb").css("background-image","url("+b+")"))},saveItem:function(a){var b=a.find(".edit-form textarea.text-element").val().split("\n"),c=a.data("metadata");"undefined"!=typeof c&&((null===c.data||"undefined"==typeof c.data)&&(c.data={}),c.data.text=b),a.removeClass("change")},defineListeners:function(){var a=this.mediaPlayer.getContainer();a.on(fr.ina.amalia.player.PlayerEventType.DATA_CHANGE,{self:this},this.onDataChange),a.on(fr.ina.amalia.player.PlayerEventType.SELECTED_METADATA_CHANGE,{self:this},this.onSelectedMetadataChange),null!==this.logger&&this.logger.trace(this.Class.fullName,"definePlayerListeners")},onDataChange:function(a,b){null!==a.data.self.metadataId&&a.data.self.metadataId===b.id&&(a.data.self.updataFormHeader(),a.data.self.updateFormItems(),null!==a.data.self.logger&&a.data.self.logger.trace(a.data.self.Class.fullName,"onSelectedItemsChange"))},onSelectedMetadataChange:function(a,b){a.data.self.metadataId=null!==b.metadataId?b.metadataId.toString():null,a.data.self.updataFormHeader(),a.data.self.updateFormItems(),null!==a.data.self.logger&&a.data.self.logger.trace(a.data.self.Class.fullName,"onSelectedMetadataChange:"+b.metadataId)},onSelectItem:function(a){a.data.self.container.find("ul.listOfSelectedItems").find("li.item").removeClass("on"),$(a.currentTarget).addClass("on");var b=$(a.currentTarget).data("metadata");b.hasOwnProperty("tcin")===!0&&null!==b.tcin?a.data.self.mediaPlayer.setCurrentTime(parseFloat(b.tcin)):b.hasOwnProperty("tc")===!0&&null!==b.tc&&a.data.self.mediaPlayer.setCurrentTime(parseFloat(b.tc)),null!==a.data.self.logger&&a.data.self.logger.trace(a.data.self.Class.fullName,"onSelectItem")},onClickToCapture:function(a){a.data.self.updateCaptureImage($(a.currentTarget).parents("li").first()),a.preventDefault(),a.stopPropagation(),null!==a.data.self.logger&&a.data.self.logger.trace(a.data.self.Class.fullName,"onClickToCapture")},onSaveItem:function(a){a.preventDefault(),a.data.self.saveItem($(a.currentTarget).parents("li").first()),null!==a.data.self.logger&&a.data.self.logger.trace(a.data.self.Class.fullName,"onClickToCapture")}});