!function(){"use strict";vare=function(t){varn=t,r=function(){returnn};return{get:r,set:function(e){n=e},clone:function(){returne(r())}}},t=tinymce.util.Tools.resolve("tinymce.PluginManager"),n=function(e){returne.getParam("insertdatetime_timeformat",e.translate("%H:%M:%S"))},r=function(e){returne.getParam("insertdatetime_formats",["%H:%M:%S","%Y-%m-%d","%I:%M:%S %p","%D"])},a=function(e){returne.getParam("insertdatetime_dateformat",e.translate("%Y-%m-%d"))},i=n,o=r,u=function(e){vart=r(e);returnt.length>0?t[0]:n(e)},c=function(e){returne.getParam("insertdatetime_element",!1)},l="Sun Mon Tue Wed Thu Fri Sat Sun".split(" "),m="Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sunday".split(" "),s="Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),d="January February March April May June July August September October November December".split(" "),p=function(e,t){if((e=""+e).length<t)for(varn=0;n<t-e.length;n++)e="0"+e;returne},f=function(e,t,n){returnn=n||newDate,t=(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",p(n.getMonth()+1,2))).replace("%d",p(n.getDate(),2))).replace("%H",""+p(n.getHours(),2))).replace("%M",""+p(n.getMinutes(),2))).replace("%S",""+p(n.getSeconds(),2))).replace("%I",""+((n.getHours()+11)%12+1))).replace("%p",n.getHours()<12?"AM":"PM")).replace("%B",""+e.translate(d[n.getMonth()]))).replace("%b",""+e.translate(s[n.getMonth()]))).replace("%A",""+e.translate(m[n.getDay()]))).replace("%a",""+e.translate(l[n.getDay()]))).replace("%%","%")},g=function(e,t){if(c(e)){varn=f(e,t),r=void0;r=/%[HMSIp]/.test(t)?f(e,"%Y-%m-%dT%H:%M"):f(e,"%Y-%m-%d");vara=e.dom.getParent(e.selection.getStart(),"time");a?(o=a,u=r,l=n,m=(i=e).dom.create("time",{datetime:u},l),o.parentNode.insertBefore(m,o),i.dom.remove(o),i.selection.select(m,!0),i.selection.collapse(!1)):e.insertContent('<time datetime="'+r+'">'+n+"</time>")}elsee.insertContent(f(e,t));vari,o,u,l,m},y=f,M=function(e){e.addCommand("mceInsertDate",function(){g(e,a(e))}),e.addCommand("mceInsertTime",function(){g(e,i(e))})},v=tinymce.util.Tools.resolve("tinymce.util.Tools"),S=function(e,t){varn,r,a,i=(r=t,a=o(n=e),v.map(a,function(e){return{text:y(n,e),onclick:function(){r.set(e),g(n,e)}}}));e.addButton("insertdatetime",{type:"splitbutton",title:"Insert date/time",menu:i,onclick:function(){varn=t.get();g(e,n||u(e))}}),e.addMenuItem("insertdatetime",{icon:"date",text:"Date/time",menu:i,context:"insert"})};t.add("insertdatetime",function(t){varn=e(null);M(t),S(t,n)})}();