!function(){"use strict";functionm(e){returne.getParam("insertdatetime_timeformat",e.translate("%H:%M:%S"))}functions(e){returne.getParam("insertdatetime_formats",["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"])}functionr(e,t){if((e=""+e).length<t)for(varn=0;n<t-e.length;n++)e="0"+e;returne}functionl(e,t,n){returnvoid0===n&&(n=newDate),(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace("%D","%m/%d/%Y")).replace("%r","%I:%M:%S %p")).replace("%Y",""+n.getFullYear())).replace("%y",""+n.getYear())).replace("%m",r(n.getMonth()+1,2))).replace("%d",r(n.getDate(),2))).replace("%H",""+r(n.getHours(),2))).replace("%M",""+r(n.getMinutes(),2))).replace("%S",""+r(n.getSeconds(),2))).replace("%I",""+((n.getHours()+11)%12+1))).replace("%p",n.getHours()<12?"AM":"PM")).replace("%B",""+e.translate(u[n.getMonth()]))).replace("%b",""+e.translate(o[n.getMonth()]))).replace("%A",""+e.translate(i[n.getDay()]))).replace("%a",""+e.translate(a[n.getDay()]))).replace("%%","%")}functiond(e,t){varn,r,a,i,o,u;e.getParam("insertdatetime_element",!1)?(n=l(e,t),r=/%[HMSIp]/.test(t)?l(e,"%Y-%m-%dT%H:%M"):l(e,"%Y-%m-%d"),(a=e.dom.getParent(e.selection.getStart(),"time"))?(o=a,u=(i=e).dom.create("time",{datetime:r},n),o.parentNode.insertBefore(u,o),i.dom.remove(o),i.selection.select(u,!0),i.selection.collapse(!1)):e.insertContent('<time datetime="'+r+'">'+n+"</time>")):e.insertContent(l(e,t))}vare=tinymce.util.Tools.resolve("tinymce.PluginManager"),a="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),i="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),o="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),u="January February March April May June July August September October November December".split(" "),p=tinymce.util.Tools.resolve("tinymce.util.Tools");e.add("insertdatetime",function(e){vart,n,r,a,i,o,u,c;(t=e).addCommand("mceInsertDate",function(){d(t,t.getParam("insertdatetime_dateformat",t.translate("%Y-%m-%d")))}),t.addCommand("mceInsertTime",function(){d(t,m(t))}),u=s(n=e),r=0<(o=s(i=n)).length?o[0]:m(i),a=r,c={get:function(){returna},set:function(e){a=e}},n.ui.registry.addSplitButton("insertdatetime",{icon:"insert-time",tooltip:"Insert date/time",select:function(e){returne===c.get()},fetch:function(e){e(p.map(u,function(e){return{type:"choiceitem",text:l(n,e),value:e}}))},onAction:function(e){d(n,c.get())},onItemAction:function(e,t){c.set(t),d(n,t)}}),n.ui.registry.addNestedMenuItem("insertdatetime",{icon:"insert-time",text:"Date/time",getSubmenuItems:function(){returnp.map(u,function(e){return{type:"menuitem",text:l(n,e),onAction:(t=e,function(){c.set(t),d(n,t)})};vart})}})})}();