text: /**
   * skylark-videojs - A version of video.js that ported to running on skylarkjs.
   * @author Hudaokeji Co.,Ltd
   * @version v0.9.0
   * @link www.skylarkjs.org
   * @license MIT
   */
  define(["../component","../modal-dialog","../utils/dom","../utils/fn","../utils/obj","../utils/log"],function(e,t,s,o,i,l){"use strict";const n="vjs-text-track-settings",a=["#000","Black"],r=["#00F","Blue"],c=["#0FF","Cyan"],d=["#0F0","Green"],p=["#F0F","Magenta"],u=["#F00","Red"],g=["#FFF","White"],h=["#FF0","Yellow"],f=["1","Opaque"],v=["0.5","Semi-Transparent"],y=["0","Transparent"],j={backgroundColor:{selector:".vjs-bg-color > select",id:"captions-background-color-%s",label:"Color",options:[a,g,u,d,r,h,p,c]},backgroundOpacity:{selector:".vjs-bg-opacity > select",id:"captions-background-opacity-%s",label:"Transparency",options:[f,v,y]},color:{selector:".vjs-fg-color > select",id:"captions-foreground-color-%s",label:"Color",options:[g,a,u,d,r,h,p,c]},edgeStyle:{selector:".vjs-edge-style > select",id:"%s",label:"Text Edge Style",options:[["none","None"],["raised","Raised"],["depressed","Depressed"],["uniform","Uniform"],["dropshadow","Dropshadow"]]},fontFamily:{selector:".vjs-font-family > select",id:"captions-font-family-%s",label:"Font Family",options:[["proportionalSansSerif","Proportional Sans-Serif"],["monospaceSansSerif","Monospace Sans-Serif"],["proportionalSerif","Proportional Serif"],["monospaceSerif","Monospace Serif"],["casual","Casual"],["script","Script"],["small-caps","Small Caps"]]},fontPercent:{selector:".vjs-font-percent > select",id:"captions-font-size-%s",label:"Font Size",options:[["0.50","50%"],["0.75","75%"],["1.00","100%"],["1.25","125%"],["1.50","150%"],["1.75","175%"],["2.00","200%"],["3.00","300%"],["4.00","400%"]],default:2,parser:e=>"1.00"===e?null:Number(e)},textOpacity:{selector:".vjs-text-opacity > select",id:"captions-foreground-opacity-%s",label:"Transparency",options:[f,v]},windowColor:{selector:".vjs-window-color > select",id:"captions-window-color-%s",label:"Color"},windowOpacity:{selector:".vjs-window-opacity > select",id:"captions-window-opacity-%s",label:"Transparency",options:[y,v,f]}};function S(e,t){if(t&&(e=t(e)),e&&"none"!==e)return e}j.windowColor.options=j.backgroundColor.options;class b extends t{constructor(e,t){t.temporary=!1,super(e,t),this.updateDisplay=o.bind(this,this.updateDisplay),this.fill(),this.hasBeenOpened_=this.hasBeenFilled_=!0,this.endDialog=s.createEl("p",{className:"vjs-control-text",textContent:this.localize("End of dialog window.")}),this.el().appendChild(this.endDialog),this.setDefaults(),void 0===t.persistTextTrackSettings&&(this.options_.persistTextTrackSettings=this.options_.playerOptions.persistTextTrackSettings),this.listenTo(this.$(".vjs-done-button"),"click",()=>{this.saveSettings(),this.close()}),this.listenTo(this.$(".vjs-default-button"),"click",()=>{this.setDefaults(),this.updateDisplay()}),i.each(j,e=>{this.listenTo(this.$(e.selector),"change",this.updateDisplay)}),this.options_.persistTextTrackSettings&&this.restoreSettings()}dispose(){this.endDialog=null,super.dispose()}createElSelect_(e,t="",s="label"){const o=j[e],i=o.id.replace("%s",this.id_),l=[t,i].join(" ").trim();return[`<${s} id="${i}" class="${"label"===s?"vjs-label":""}">`,this.localize(o.label),`</${s}>`,`<select aria-labelledby="${l}">`].concat(o.options.map(e=>{const t=i+"-"+e[1].replace(/\W+/g,"");return[`<option id="${t}" value="${e[0]}" `,`aria-labelledby="${l} ${t}">`,this.localize(e[1]),"</option>"].join("")})).concat("</select>").join("")}createElFgColor_(){const e=`captions-text-legend-${this.id_}`;return['<fieldset class="vjs-fg-color vjs-track-setting">',`<legend id="${e}">`,this.localize("Text"),"</legend>",this.createElSelect_("color",e),'<span class="vjs-text-opacity vjs-opacity">',this.createElSelect_("textOpacity",e),"</span>","</fieldset>"].join("")}createElBgColor_(){const e=`captions-background-${this.id_}`;return['<fieldset class="vjs-bg-color vjs-track-setting">',`<legend id="${e}">`,this.localize("Background"),"</legend>",this.createElSelect_("backgroundColor",e),'<span class="vjs-bg-opacity vjs-opacity">',this.createElSelect_("backgroundOpacity",e),"</span>","</fieldset>"].join("")}createElWinColor_(){const e=`captions-window-${this.id_}`;return['<fieldset class="vjs-window-color vjs-track-setting">',`<legend id="${e}">`,this.localize("Window"),"</legend>",this.createElSelect_("windowColor",e),'<span class="vjs-window-opacity vjs-opacity">',this.createElSelect_("windowOpacity",e),"</span>","</fieldset>"].join("")}createElColors_(){return s.createEl("div",{className:"vjs-track-settings-colors",innerHTML:[this.createElFgColor_(),this.createElBgColor_(),this.createElWinColor_()].join("")})}createElFont_(){return s.createEl("div",{className:"vjs-track-settings-font",innerHTML:['<fieldset class="vjs-font-percent vjs-track-setting">',this.createElSelect_("fontPercent","","legend"),"</fieldset>",'<fieldset class="vjs-edge-style vjs-track-setting">',this.createElSelect_("edgeStyle","","legend"),"</fieldset>",'<fieldset class="vjs-font-family vjs-track-setting">',this.createElSelect_("fontFamily","","legend"),"</fieldset>"].join("")})}createElControls_(){const e=this.localize("restore all settings to the default values");return s.createEl("div",{className:"vjs-track-settings-controls",innerHTML:[`<button type="button" class="vjs-default-button" title="${e}">`,this.localize("Reset"),`<span class="vjs-control-text"> ${e}</span>`,"</button>",`<button type="button" class="vjs-done-button">${this.localize("Done")}</button>`].join("")})}content(){return[this.createElColors_(),this.createElFont_(),this.createElControls_()]}label(){return this.localize("Caption Settings Dialog")}description(){return this.localize("Beginning of dialog window. Escape will cancel and close the window.")}buildCSSClass(){return super.buildCSSClass()+" vjs-text-track-settings"}getValues(){return i.reduce(j,(s,o,i)=>{const l=(e=this.$(o.selector),t=o.parser,S(e.options[e.options.selectedIndex].value,t));return void 0!==l&&(s[i]=l),s},{});var e,t}setValues(e){i.each(j,(t,s)=>{!function(e,t,s){if(t)for(let o=0;o<e.options.length;o++)if(S(e.options[o].value,s)===t){e.selectedIndex=o;break}}(this.$(t.selector),e[s],t.parser)})}setDefaults(){i.each(j,e=>{const t=e.hasOwnProperty("default")?e.default:0;this.$(e.selector).selectedIndex=t})}restoreSettings(){let e;try{e=JSON.parse(window.localStorage.getItem(n))}catch(e){l.warn(e)}e&&this.setValues(e)}saveSettings(){if(!this.options_.persistTextTrackSettings)return;const e=this.getValues();try{Object.keys(e).length?window.localStorage.setItem(n,JSON.stringify(e)):window.localStorage.removeItem(n)}catch(e){l.warn(e)}}updateDisplay(){const e=this.player_.getChild("textTrackDisplay");e&&e.updateDisplay()}conditionalBlur_(){this.previouslyActiveEl_=null;const e=this.player_.controlBar,t=e&&e.subsCapsButton,s=e&&e.captionsButton;t?t.focus():s&&s.focus()}}return e.registerComponent("TextTrackSettings",b),b});
  //# sourceMappingURL=../sourcemaps/tracks/text-track-settings.js.map
  