// source --> https://www.asiplanning.com.au/wp-content/plugins/pixelyoursite-pro/js/public.js?ver=6.5.2 /* global pys_fb_pixel_options, pys_fb_pixel_regular_events, pys_fb_pixel_dynamic_triggers, pys_fb_pixel_dynamic_events, pys_fb_pixel_custom_code_events */ var runPYS = function (){ var $ = window.jQuery; if (pys_fb_pixel_options.initialized === true) { return; // prevent double firing from Cookiebot.onaccept } else { pys_fb_pixel_options.initialized = true; } var options = pys_fb_pixel_options; var utm_terms = ['utm_source', 'utm_media', 'utm_campaign', 'utm_term', 'utm_content']; var scroll_pos_thresholds = {}; // Load FB pixel !function (f, b, e, v, n, t, s) { if (f.fbq) return; n = f.fbq = function () { n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments) }; if (!f._fbq) f._fbq = n; n.push = n; n.loaded = !0; n.version = '2.0'; n.agent = 'dvpixelyoursite'; n.queue = []; t = b.createElement(e); t.async = !0; t.src = v; s = b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t, s) }(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js'); var clone = function (src, dest) { for (var key in src) { dest[key] = src[key]; } return dest; }; var getFacebookEventType = function (event_name) { var std_events = [ 'PageView', 'ViewContent', 'Search', 'AddToCart', 'AddToWishlist', 'InitiateCheckout', 'AddPaymentInfo', 'Purchase', 'Lead' ]; return $.inArray(event_name, std_events) !== -1 ? 'track' : 'trackCustom' }; var wooLoopAddToCart = function (product_id, event_name) { if (typeof pys_woo_product_data[product_id] !== 'undefined') { var params = pys_woo_product_data[product_id]; var event = { type: getFacebookEventType(event_name), name: event_name, params: params }; event = addTrafficSourceParams(event); fbq(event.type, event.name, event.params); } }; if (options.woo.addtocart_enabled) { // Loop, any kind of "simple" product, except external $('.add_to_cart_button:not(.product_type_variable)').click(function () { window.pys_woo_product_data = window.pys_woo_product_data || []; var $button = $(this); var product_id = $button.data('product_id'); if (typeof product_id !== 'undefined') { wooLoopAddToCart(product_id, 'AddToCart'); } }); // Single Product $('.single_add_to_cart_button').click(function (e) { var $button = $(this); if ($button.hasClass('disabled')) { return; } var $form = $button.closest('form'); var is_variable = false; var is_external = false; if ($form.length === 0) { is_external = true; } else if ($form.hasClass('variations_form')) { is_variable = true; } var qty; var product_id = options.woo.product_id; if (is_variable) { qty = parseInt($form.find('input[name="quantity"]').val()); if (options.woo.product_data !== 'main') { product_id = parseInt($form.find('input[name="variation_id"]').val()); } } else if (is_external) { qty = 1; } else { qty = parseInt($form.find('input[name="quantity"]').val()); } window.pys_woo_product_data = window.pys_woo_product_data || []; if (typeof pys_woo_product_data[product_id] !== 'undefined') { var params = pys_woo_product_data[product_id]; // maybe customize value option if (options.woo.product_value_enabled && options.woo.product_value_option !== 'global') { params.value = params.value * qty; } // update contents qty param var contents = JSON.parse(params.contents); contents[0].quantity = qty; params.contents = JSON.stringify(contents); var event_name = is_external ? options.woo.affiliate_event_name : 'AddToCart'; var event = { type: getFacebookEventType(event_name), name: event_name, params: params }; event = addTrafficSourceParams(event); fbq(event.type, event.name, event.params); } }); } if (options.woo.affiliate_enabled) { // Loop, external $('.product_type_external').click(function () { window.pys_woo_product_data = window.pys_woo_product_data || []; var $button = $(this); var product_id = $button.data('product_id'); if (typeof product_id !== 'undefined') { wooLoopAddToCart(product_id, options.woo.affiliate_event_name); } }); } manageCookies(); regularEvents(); regularCustomCodeEvents(); dynamicEvents(); // WooCommerce PayPal Event $(document).on('submit click', '#place_order', function () { var method = $('input[name="payment_method"]:checked').val(); if (method === false || method !== 'paypal') { return; } try { if (typeof pys_fb_pixel_woo_paypal_event_id === 'undefined' || typeof pys_fb_pixel_ajax_events === 'undefined') { return; } if (pys_fb_pixel_ajax_events.hasOwnProperty(pys_fb_pixel_woo_paypal_event_id)) { evaluateDynamicEventByID(pys_fb_pixel_ajax_events[pys_fb_pixel_woo_paypal_event_id]); } } catch (e) { console.log(e); } }); // EDD AddToCart $('.edd-add-to-cart').click(function () { try { // extract pixel event ids from classes like 'pys-event-id-{UNIQUE ID}' var classes = $.grep(this.className.split(" "), function (element, index) { return element.indexOf('pys-fb-event-id-') === 0; }); // verify that we have at least one matching class if (typeof classes === 'undefined' || classes.length === 0) { return; } // extract event id from class name var regexp = /pys-fb-event-id-(.*)/; var event_id = regexp.exec(classes[0]); if (event_id === null) { return; } event_id = event_id[1]; if (pys_fb_pixel_ajax_events.hasOwnProperty(event_id)) { evaluateDynamicEventByID(pys_fb_pixel_ajax_events[event_id]); } } catch (e) { console.log(e); } }); /** * Process Init, PageView, General, Search, WooCommerce (except ajax-ed AddToCart), * and Custom On Page events. In case if delay param is present - event will be fired after desired timeout. */ function regularEvents() { try { if (typeof pys_fb_pixel_regular_events === 'undefined') { return; } for (var i = 0; i < pys_fb_pixel_regular_events.length; i++) { var event = pys_fb_pixel_regular_events[i]; // optionally, add traffic source params event = addTrafficSourceParams(event); if (event.hasOwnProperty('delay') === false || event.delay === 0) { fbq(event.type, event.name, event.params); } else { setTimeout(function (type, name, params) { fbq(type, name, params); }, event.delay * 1000, event.type, event.name, event.params); } } } catch (e) { console.error(e); } } /** * Process only custom code regular events. */ function regularCustomCodeEvents() { if (typeof pys_fb_pixel_custom_code_events === 'undefined') { return; } $.each(pys_fb_pixel_custom_code_events, function (index, code) { eval(code); }); } function dynamicEvents() { if (typeof pys_fb_pixel_dynamic_triggers === 'undefined' || typeof pys_fb_pixel_dynamic_events === 'undefined') { return; } // setup listeners for css click, css mouse over triggers // setup scroll pos thresholds $.each(pys_fb_pixel_dynamic_triggers, function (index, trigger) { switch (trigger.trigger_type) { case 'css_click': attachCssClickHandler(trigger); break; case 'css_mouseover': attachMouseOverHandler(trigger); break; case 'scroll_pos': setupScrollPosThresholds(trigger); break; default: break; } }); // setup url click handlers $('[data-pys-event-id]').onFirst('click', function () { // Non-default binding used to avoid situations when some code in external js // stopping events propagation, eg. returns false, and our handler will never called. $(this).attr('data-pys-event-id').split(',').forEach(function (item) { var event_id = parseInt(item); if (isNaN(event_id) === false) { if (pys_fb_pixel_dynamic_events.hasOwnProperty(event_id)) { evaluateDynamicEventByID(pys_fb_pixel_dynamic_events[event_id]); } } }); }); // manage on scroll triggers $(document).scroll(function () { var scroll_pos = $(window).scrollTop(); $.each(scroll_pos_thresholds, function (scroll_threshold, events_ids) { scroll_threshold = parseInt(scroll_threshold.substring(1)); // integer threshold value // position is not reached if (scroll_pos <= scroll_threshold) { return true; } // fire events for current threshold $.map(events_ids, function (event_id, index) { // fire event only once for current scroll pos scroll_pos_thresholds['_' + scroll_threshold][index] = null; if (pys_fb_pixel_dynamic_events.hasOwnProperty(event_id)) { evaluateDynamicEventByID(pys_fb_pixel_dynamic_events[event_id]); } }); }); }); } function setupScrollPosThresholds(trigger) { var height = $(document).height() - $(window).height(); // convert % to pixels var scroll_pos = parseInt(trigger.trigger_value); scroll_pos = height * scroll_pos / 100; scroll_pos = Math.round(scroll_pos); scroll_pos = '_' + scroll_pos; // add new position if (typeof scroll_pos_thresholds[scroll_pos] === 'undefined') { scroll_pos_thresholds[scroll_pos] = []; } // array is used because many events can be attached to same scroll position // so each position has an array with events ids scroll_pos_thresholds[scroll_pos].push(trigger.event_id); } function attachCssClickHandler(trigger) { // Non-default binding used to avoid situations when some code in external js // stopping events propagation, eg. returns false, and our handler will never called $(document).onFirst('click', trigger.trigger_value, function () { if (pys_fb_pixel_dynamic_events.hasOwnProperty(trigger.event_id)) { evaluateDynamicEventByID(pys_fb_pixel_dynamic_events[trigger.event_id]); } }); } function attachMouseOverHandler(trigger) { // Non-default binding used to avoid situations when some code in external js // stopping events propagation, eg. returns false, and our handler will never called $(trigger.trigger_value).onFirst('mouseover', function () { // event should be fired only once if ($(this).hasClass('pys-mouse-over-' + trigger.event_id)) { return; } $(this).addClass('pys-mouse-over-' + trigger.event_id); if (pys_fb_pixel_dynamic_events.hasOwnProperty(trigger.event_id)) { evaluateDynamicEventByID(pys_fb_pixel_dynamic_events[trigger.event_id]); } }); } function evaluateDynamicEventByID(event) { if (event.hasOwnProperty('custom_code')) { eval(event.custom_code); } else { event = addTrafficSourceParams(event); fbq(event.type, event.name, event.params); } } function getTrafficSource() { try { var referrer = document.referrer.toString(); var direct = referrer.length === 0; //noinspection JSUnresolvedVariable var internal = direct ? false : referrer.indexOf(pys_fb_pixel_options.site_url) === 0; var external = !(direct || internal); var cookie = typeof Cookies.get('pys_fb_pixel_traffic_source') === 'undefined' ? false : Cookies.get('pys_fb_pixel_traffic_source'); if (external === false) { return cookie ? cookie : 'direct'; } else { return cookie && cookie === referrer ? cookie : referrer; } } catch (e) { console.log(e); return ''; } } /** * Return UTM terms from request query variables or from cookies. */ function getUTMs() { try { var terms = {}; var queryVars = getQueryVars(); $.each(utm_terms, function (index, name) { if (Cookies.get('pys_fb_pixel_' + name)) { terms[name] = Cookies.get('pys_fb_pixel_' + name); } else if (queryVars.hasOwnProperty(name)) { terms[name] = queryVars[name]; } }); return terms; } catch (e) { console.log(e); return {}; } } function manageCookies() { try { var source = getTrafficSource(); if (source !== 'direct') { Cookies.set('pys_fb_pixel_traffic_source', source); } else { Cookies.remove('pys_fb_pixel_traffic_source'); } var queryVars = getQueryVars(); $.each(utm_terms, function (index, name) { if (Cookies.get('pys_fb_pixel_' + name) === undefined && queryVars.hasOwnProperty(name)) { Cookies.set('pys_fb_pixel_' + name, queryVars[name]); } }); } catch (e) { console.log(e); } } /** * Add `traffic_source` and `utm` params to event params for any event except `init`. */ function addTrafficSourceParams(event) { try { //noinspection JSUnresolvedVariable if (pys_fb_pixel_options.track_traffic_source === false || event.type === 'init') { return event; } event.params.traffic_source = getTrafficSource(); $.each(getUTMs(), function (name, value) { if ($.inArray(name, utm_terms) >= 0) { event.params[name] = value; } }); return event; } catch (e) { console.log(e); return event; } } /** * Return query variables object with where property name is query variable and property value is query variable value. */ function getQueryVars() { try { var result = {}, tmp = []; window.location.search .substr(1) .split("&") .forEach(function (item) { tmp = item.split('='); if (tmp.length > 1) { result[tmp[0]] = tmp[1]; } }); return result; } catch (e) { console.log(e); return {}; } } if (pys_fb_pixel_options.click_event_enabled) { /** * ClickEvent listener. * * @since 6.2.1 */ $(document).onFirst('click', 'a, button, input[type="button"], input[type="submit"]', function () { var params = {}; for (var key in pys_fb_pixel_options.content_params) { params[key] = pys_fb_pixel_options.content_params[key]; } var elem = $(this), event = { type: 'trackCustom', name: 'ClickEvent', params: params }; if (elem.is('a')) { event.params.tag_type = 'a'; event.params.tag_text = elem.text(); } else if (elem.is('button')) { event.params.tag_type = 'button'; event.params.tag_text = elem.text(); } else if (elem.is('input[type="button"]')) { event.params.tag_type = 'input.button'; event.params.tag_text = elem.val(); } else { event.params.tag_type = 'input.submit'; event.params.tag_text = elem.val(); } event = addTrafficSourceParams(event); fbq(event.type, event.name, event.params); }); } window.pys_fb_event = function (params, name) { for (var key in pys_fb_pixel_options.content_params) { params[key] = pys_fb_pixel_options.content_params[key]; } var event = { type: 'trackCustom', name: name, params: params }; event = addTrafficSourceParams(event); fbq(event.type, event.name, event.params); }; }; jQuery(document).ready(function () { if (typeof pys_fb_pixel_options !== 'undefined') { // tracking in not disabled with filter by 3rd party if (!pys_fb_pixel_options.gdpr.disable) { var getCookie = function (name) { var value = "; " + document.cookie; var parts = value.split("; " + name + "="); if (parts.length === 2) return parts.pop().split(";").shift(); }; /** * @link http://gdpr-wp.com/knowledge-base/functions-shortcodes/ * @link https://www.cookiebot.com/en/developer/ * * "enable_before_consent" option logic: * - when it ON, run tracking with no cookie or consent is given * - when it OFF, run tracking only when consent is given */ if (pys_fb_pixel_options.gdpr.ginger_enabled) { var ginger_cookie = getCookie('ginger-cookie'); if (pys_fb_pixel_options.gdpr.enable_before_consent) { if (typeof ginger_cookie === 'undefined' || ginger_cookie === 'Y') { runPYS(); } else { console.warn('PixelYourSite PRO is disabled by Ginger - EU Cookie Law plugin.'); } } else { if (ginger_cookie === 'Y') { runPYS(); } else { console.warn('PixelYourSite PRO is disabled by Ginger - EU Cookie Law plugin.'); } } } else if (pys_fb_pixel_options.gdpr.cookiebot_enabled && typeof Cookiebot !== 'undefined') { if (pys_fb_pixel_options.gdpr.enable_before_consent) { if (Cookiebot.consented === false || Cookiebot.consent.marketing) { runPYS(); } else { console.warn('PixelYourSite PRO is disabled by Cookiebot plugin.'); } } else { if (Cookiebot.consent.marketing) { runPYS(); } else { console.warn('PixelYourSite PRO is disabled by Cookiebot plugin.'); } } // setup Cookiebot on accept callback Cookiebot.onaccept = function () { if (Cookiebot.consent.marketing) { runPYS(); } } } else { runPYS(); } } else { console.warn('PixelYourSite PRO is disabled by GDPR.'); } } }); // source --> https://www.asiplanning.com.au/wp-content/plugins/pixelyoursite-pro/js/yt-track.js?ver=6.5.2 //@see: https://developers.google.com/youtube/iframe_api_reference (function (document, window, $) { // Maybe load YouTube JS API if (typeof window.YT === 'undefined') { var tag = document.createElement('script'); tag.src = '//www.youtube.com/iframe_api'; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); } // Initialize when API is ready window.onYouTubeIframeAPIReady = function () { $(document).trigger('yt_api_ready'); }; // Invoked by the YouTube API when it's ready $(document).on('yt_api_ready', function init() { var potentialVideos = getTagsAsArr_('iframe').concat(getTagsAsArr_('embed')); digestPotentialVideos(potentialVideos); // Will bind to dynamically added videos. CAPTURE NOT SUPPORTED BY IE8 if ('addEventListener' in document) { document.addEventListener('load', bindToNewVideos_, true); } }); // Add event handlers for events emitted by the YouTube API function addYouTubeEvents(youTubeIframe) { var player = YT.get(youTubeIframe.id); if (!player) { player = new YT.Player(youTubeIframe, {}); } if (typeof youTubeIframe.pauseFlag === 'undefined') { youTubeIframe.pauseFlag = false; player.addEventListener('onStateChange', function (evt) { onStateChangeHandler(evt, youTubeIframe); }); } } // Event handler for events emitted from the YouTube API function onStateChangeHandler(evt, youTubeIframe) { var stateIndex = evt.data; var player = evt.target; var targetVideoUrl = player.getVideoUrl(); var targetVideoId = targetVideoUrl.match(/[?&]v=([^&#]*)/)[1]; // Extract the ID var playerState = player.getPlayerState(); var marks = getMarks(player.getDuration()); youTubeIframe.playTracker = youTubeIframe.playTracker || {}; if (playerState === YT.PlayerState.PLAYING && !youTubeIframe.timer) { clearInterval(youTubeIframe.timer); // Check every second to see if we've hit any of our percentage viewed marks youTubeIframe.timer = setInterval(function () { checkCompletion(player, marks, youTubeIframe.videoId); }, 1000); } else { clearInterval(youTubeIframe.timer); youTubeIframe.timer = false; } // Playlist edge-case handler if (stateIndex === YT.PlayerState.PLAYING) { youTubeIframe.playTracker[targetVideoId] = true; youTubeIframe.videoId = targetVideoId; youTubeIframe.pauseFlag = false; } if (!youTubeIframe.playTracker[youTubeIframe.videoId]) { return false; // This video hasn't started yet, so this is spam } if (stateIndex === YT.PlayerState.PAUSED) { if (!youTubeIframe.pauseFlag) { youTubeIframe.pauseFlag = true; } else { return false; // We don't want to fire consecutive pause events } } } function checkCompletion(player, marks, videoId) { var currentTime = player.getCurrentTime(); player[videoId] = player[videoId] || {}; for (var key in marks) { if (marks[key] <= currentTime && !player[videoId][key]) { player[videoId][key] = true; var data = player.getVideoData(); jQuery(window).trigger('pys_yt_watch_video', { video_id: videoId, video_title: data.title, event_trigger: key }); } } } jQuery(window).on('pys_yt_watch_video', function (e, data) { if (data.event_trigger === '0%') { data.event_trigger = 'play'; } if (typeof pys_fb_event !== 'undefined') { pys_fb_event(data, 'WatchVideo'); } }); // Returns key/value pairs of percentages: number of seconds to achieve function getMarks(duration) { var marks = {}; var points = [0,10,50,90,100]; for (var i = 0; i < points.length; i++) { var _point = points[i]; var _mark = _point + '%'; var _time = duration * _point / 100; if ( _point === 100 ) { _time = _time - 1; } // 10% => 123 marks[_mark] = Math.floor(_time); } return marks; } // Returns array of elements with given tag name function getTagsAsArr_(tagName) { return [].slice.call(document.getElementsByTagName(tagName)); } // Determine if the element is a YouTube video or not function checkIfYouTubeVideo(potentialYouTubeVideo) { var potentialYouTubeVideoSrc = potentialYouTubeVideo.src || ''; return potentialYouTubeVideoSrc.indexOf('youtube.com/embed/') > -1 || potentialYouTubeVideoSrc.indexOf('youtube.com/v/') > -1; } // Turn embed objects into iframe objects and ensure they have the right parameters function normalizeYouTubeIframe(youTubeVideo) { var loc = window.location; var a = document.createElement('a'); a.href = youTubeVideo.src; a.hostname = 'www.youtube.com'; a.protocol = loc.protocol; var tmpPathname = a.pathname.charAt(0) === '/' ? a.pathname : '/' + a.pathname; // IE10 shim // For security reasons, YouTube wants an origin parameter set that matches our hostname if (!jsApiEnabled(a.search)) { a.search = (a.search.length > 0 ? a.search + '&' : '') + 'enablejsapi=1'; } if (!originEnabled(a.search) && loc.hostname.indexOf('localhost') === -1) { var port = loc.port ? ':' + loc.port : ''; var origin = loc.protocol + '%2F%2F' + loc.hostname + port; a.search = a.search + '&origin=' + origin; } if (youTubeVideo.type === 'application/x-shockwave-flash') { var newIframe = document.createElement('iframe'); newIframe.height = youTubeVideo.height; newIframe.width = youTubeVideo.width; tmpPathname = tmpPathname.replace('/v/', '/embed/'); youTubeVideo.parentNode.parentNode.replaceChild(newIframe, youTubeVideo.parentNode); youTubeVideo = newIframe; } a.pathname = tmpPathname; if (youTubeVideo.src !== a.href + a.hash) { youTubeVideo.src = a.href + a.hash; } return youTubeVideo; } // Take our videos and turn them into trackable videos with events function digestPotentialVideos(potentialVideos) { for (var i = 0; i < potentialVideos.length; i++) { var isYouTubeVideo = checkIfYouTubeVideo(potentialVideos[i]); if (isYouTubeVideo) { var normalizedYouTubeIframe = normalizeYouTubeIframe(potentialVideos[i]); addYouTubeEvents(normalizedYouTubeIframe); } } } function jsApiEnabled(url) { return url.indexOf('enablejsapi') > -1; } function originEnabled(url) { return url.indexOf('origin') > -1; } // Simple cross-browser event listener function addEvent(el, name, fn) { if (el.addEventListener) { el.addEventListener(name, fn); } else if (el.attachEvent) { el.attachEvent('on' + name, function (evt) { evt.target = evt.target || evt.srcElement; // Call the event to ensure uniform 'this' handling, pass it event fn.call(el, evt); }); } else if (typeof el['on' + name] === 'undefined' || el['on' + name] === null) { el['on' + name] = function (evt) { evt.target = evt.target || evt.srcElement; // Call the event to ensure uniform 'this' handling, pass it event fn.call(el, evt); }; } } function bindToNewVideos_(evt) { var el = evt.target || evt.srcElement; var isYT = checkIfYouTubeVideo(el); // We only bind to iframes with a YouTube URL with the enablejsapi=1 and // origin=<> parameters if (el.tagName === 'IFRAME' && isYT && jsApiEnabled(el.src) && originEnabled(el.src)) { addYouTubeEvents(el); } } })(document, window, jQuery); // source --> https://www.asiplanning.com.au/wp-content/plugins/pixelyoursite-pro/js/vimeo.min.js?ver=6.5.2 /*! @vimeo/player v2.2.0 | (c) 2017 Vimeo | MIT License | https://github.com/vimeo/player.js */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e.Vimeo=e.Vimeo||{},e.Vimeo.Player=t())}(this,function(){"use strict";function e(e,t){return t={exports:{}},e(t,t.exports),t.exports}function t(e,t,n){var r=E.get(e.element)||{};t in r||(r[t]=[]),r[t].push(n),E.set(e.element,r)}function n(e,t){return(E.get(e.element)||{})[t]||[]}function r(e,t,n){var r=E.get(e.element)||{};if(!r[t])return!0;if(!n)return r[t]=[],E.set(e.element,r),!0;var i=r[t].indexOf(n);return-1!==i&&r[t].splice(i,1),E.set(e.element,r),r[t]&&0===r[t].length}function i(e,t){var i=n(e,t);if(i.length<1)return!1;var o=i.shift();return r(e,t,o),o}function o(e,t){var n=E.get(e);E.set(t,n),E.delete(e)}function a(e,t){return 0===e.indexOf(t.toLowerCase())?e:""+t.toLowerCase()+e.substr(0,1).toUpperCase()+e.substr(1)}function u(e){return e instanceof window.HTMLElement}function s(e){return!isNaN(parseFloat(e))&&isFinite(e)&&Math.floor(e)==e}function c(e){return/^(https?:)?\/\/((player|www).)?vimeo.com(?=$|\/)/.test(e)}function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.id,n=e.url,r=t||n;if(!r)throw new Error("An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.");if(s(r))return"https://vimeo.com/"+r;if(c(r))return r.replace("http:","https:");if(t)throw new TypeError("“"+t+"” is not a valid video id.");throw new TypeError("“"+r+"” is not a vimeo.com url.")}function l(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return T.reduce(function(t,n){var r=e.getAttribute("data-vimeo-"+n);return(r||""===r)&&(t[n]=""===r?1:r),t},t)}function h(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,r){if(!c(e))throw new TypeError("“"+e+"” is not a vimeo.com url.");var i="https://vimeo.com/api/oembed.json?url="+encodeURIComponent(e);for(var o in t)t.hasOwnProperty(o)&&(i+="&"+o+"="+encodeURIComponent(t[o]));var a="XDomainRequest"in window?new XDomainRequest:new XMLHttpRequest;a.open("GET",i,!0),a.onload=function(){if(404===a.status)return void r(new Error("“"+e+"” was not found."));if(403===a.status)return void r(new Error("“"+e+"” is not embeddable."));try{var t=JSON.parse(a.responseText);n(t)}catch(e){r(e)}},a.onerror=function(){var e=a.status?" ("+a.status+")":"";r(new Error("There was an error fetching the embed code from Vimeo"+e+"."))},a.send()})}function d(e,t){var n=e.html;if(!t)throw new TypeError("An element must be provided");if(null!==t.getAttribute("data-vimeo-initialized"))return t.querySelector("iframe");var r=document.createElement("div");return r.innerHTML=n,t.appendChild(r.firstChild),t.setAttribute("data-vimeo-initialized","true"),t.querySelector("iframe")}function v(e){return"string"==typeof e&&(e=JSON.parse(e)),e}function p(e,t,n){if(e.element.contentWindow&&e.element.contentWindow.postMessage){var r={method:t};void 0!==n&&(r.value=n);var i=parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/,"$1"));i>=8&&i<10&&(r=JSON.stringify(r)),e.element.contentWindow.postMessage(r,e.origin)}}function y(e,t){t=v(t);var o=[],a=void 0;if(t.event){if("error"===t.event){n(e,t.data.method).forEach(function(n){var i=new Error(t.data.message);i.name=t.data.name,n.reject(i),r(e,t.data.method,n)})}o=n(e,"event:"+t.event),a=t.data}else if(t.method){var u=i(e,t.method);u&&(o.push(u),a=t.value)}o.forEach(function(t){try{if("function"==typeof t)return void t.call(e,a);t.resolve(a)}catch(e){}})}function m(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var g=void 0!==Array.prototype.indexOf,w=void 0!==window.postMessage;if(!g||!w)throw new Error("Sorry, the Vimeo Player API is not available in this browser.");var k="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},b=(e(function(e,t){!function(e){function t(e,t){function r(e){if(!this||this.constructor!==r)return new r(e);this._keys=[],this._values=[],this._itp=[],this.objectOnly=t,e&&n.call(this,e)}return t||w(e,"size",{get:y}),e.constructor=r,r.prototype=e,r}function n(e){this.add?e.forEach(this.add,this):e.forEach(function(e){this.set(e[0],e[1])},this)}function r(e){return this.has(e)&&(this._keys.splice(g,1),this._values.splice(g,1),this._itp.forEach(function(e){g0&&e(r,u))}catch(e){a.call(new s(u),e)}}}function a(t){var n=this;n.triggered||(n.triggered=!0,n.def&&(n=n.def),n.msg=t,n.state=2,n.chain.length>0&&e(r,n))}function u(e,t,n,r){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{};if(m(this,Player),window.jQuery&&e instanceof jQuery&&(e.length>1&&window.console&&console.warn&&console.warn("A jQuery object with multiple elements was passed, using the first element."),e=e[0]),"string"==typeof e&&(e=document.getElementById(e)),!u(e))throw new TypeError("You must pass either a valid element or a valid id.");if("IFRAME"!==e.nodeName){var r=e.querySelector("iframe");r&&(e=r)}if("IFRAME"===e.nodeName&&!c(e.getAttribute("src")||""))throw new Error("The player element passed isn’t a Vimeo embed.");if(j.has(e))return j.get(e);this.element=e,this.origin="*";var i=new b(function(r,i){var a=function(e){if(c(e.origin)&&t.element.contentWindow===e.source){"*"===t.origin&&(t.origin=e.origin);var n=v(e.data),i="event"in n&&"ready"===n.event,o="method"in n&&"ping"===n.method;if(i||o)return t.element.setAttribute("data-ready","true"),void r();y(t,n)}};if(window.addEventListener?window.addEventListener("message",a,!1):window.attachEvent&&window.attachEvent("onmessage",a),"IFRAME"!==t.element.nodeName){var u=l(e,n);h(f(u),u).then(function(n){var r=d(n,e);return t.element=r,o(e,r),j.set(t.element,t),n}).catch(function(e){return i(e)})}});return x.set(this,i),j.set(this.element,this),"IFRAME"===this.element.nodeName&&p(this,"ping"),this}return _(Player,[{key:"callMethod",value:function(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new b(function(i,o){return n.ready().then(function(){t(n,e,{resolve:i,reject:o}),p(n,e,r)})})}},{key:"get",value:function(e){var n=this;return new b(function(r,i){return e=a(e,"get"),n.ready().then(function(){t(n,e,{resolve:r,reject:i}),p(n,e)})})}},{key:"set",value:function(e,n){var r=this;return b.resolve(n).then(function(n){if(e=a(e,"set"),void 0===n||null===n)throw new TypeError("There must be a value to set.");return r.ready().then(function(){return new b(function(i,o){t(r,e,{resolve:i,reject:o}),p(r,e,n)})})})}},{key:"on",value:function(e,r){if(!e)throw new TypeError("You must pass an event name.");if(!r)throw new TypeError("You must pass a callback function.");if("function"!=typeof r)throw new TypeError("The callback must be a function.");0===n(this,"event:"+e).length&&this.callMethod("addEventListener",e).catch(function(){}),t(this,"event:"+e,r)}},{key:"off",value:function(e,t){if(!e)throw new TypeError("You must pass an event name.");if(t&&"function"!=typeof t)throw new TypeError("The callback must be a function.");r(this,"event:"+e,t)&&this.callMethod("removeEventListener",e).catch(function(e){})}},{key:"loadVideo",value:function(e){return this.callMethod("loadVideo",e)}},{key:"ready",value:function(){var e=x.get(this);return b.resolve(e)}},{key:"addCuePoint",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.callMethod("addCuePoint",{time:e,data:t})}},{key:"removeCuePoint",value:function(e){return this.callMethod("removeCuePoint",e)}},{key:"enableTextTrack",value:function(e,t){if(!e)throw new TypeError("You must pass a language.");return this.callMethod("enableTextTrack",{language:e,kind:t})}},{key:"disableTextTrack",value:function(){return this.callMethod("disableTextTrack")}},{key:"pause",value:function(){return this.callMethod("pause")}},{key:"play",value:function(){return this.callMethod("play")}},{key:"unload",value:function(){return this.callMethod("unload")}},{key:"getAutopause",value:function(){return this.get("autopause")}},{key:"setAutopause",value:function(e){return this.set("autopause",e)}},{key:"getColor",value:function(){return this.get("color")}},{key:"setColor",value:function(e){return this.set("color",e)}},{key:"getCuePoints",value:function(){return this.get("cuePoints")}},{key:"getCurrentTime",value:function(){return this.get("currentTime")}},{key:"setCurrentTime",value:function(e){return this.set("currentTime",e)}},{key:"getDuration",value:function(){return this.get("duration")}},{key:"getEnded",value:function(){return this.get("ended")}},{key:"getLoop",value:function(){return this.get("loop")}},{key:"setLoop",value:function(e){return this.set("loop",e)}},{key:"getPaused",value:function(){return this.get("paused")}},{key:"getPlaybackRate",value:function(){return this.get("playbackRate")}},{key:"setPlaybackRate",value:function(e){return this.set("playbackRate",e)}},{key:"getTextTracks",value:function(){return this.get("textTracks")}},{key:"getVideoEmbedCode",value:function(){return this.get("videoEmbedCode")}},{key:"getVideoId",value:function(){return this.get("videoId")}},{key:"getVideoTitle",value:function(){return this.get("videoTitle")}},{key:"getVideoWidth",value:function(){return this.get("videoWidth")}},{key:"getVideoHeight",value:function(){return this.get("videoHeight")}},{key:"getVideoUrl",value:function(){return this.get("videoUrl")}},{key:"getVolume",value:function(){return this.get("volume")}},{key:"setVolume",value:function(e){return this.set("volume",e)}}]),Player}();return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=[].slice.call(e.querySelectorAll("[data-vimeo-id], [data-vimeo-url]")),n=function(e){"console"in window&&console.error&&console.error("There was an error creating an embed: "+e)};t.forEach(function(e){try{if(null!==e.getAttribute("data-vimeo-defer"))return;var t=l(e);h(f(t),t).then(function(t){return d(t,e)}).catch(n)}catch(e){n(e)}})}(),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,t=function(t){if(c(t.origin)&&t.data&&"spacechange"===t.data.event)for(var n=e.querySelectorAll("iframe"),r=0;r https://www.asiplanning.com.au/wp-content/plugins/pixelyoursite-pro/js/vimeo-track.js?ver=6.5.2 //@see: https://github.com/vimeo/player.js (function (document, window, $) { $(document).ready(function () { var potentialVideos = getTagsAsArr_('iframe').concat(getTagsAsArr_('embed')); for (var i = 0; i < potentialVideos.length; i++) { if (!checkIfVimeoVideo(potentialVideos[i])) { continue; } var player = new Vimeo.Player(potentialVideos[i]); player.on('play', function () { if( this.pys_fb_timer ) { return; } clearInterval(this.pys_fb_timer); var player = this; this.pys_fb_timer = setInterval(function () { checkCompletion(player); }, 1000); }); player.on('pause', function () { clearInterval(this.pys_fb_timer); this.pys_fb_timer = false; }); player.on('ended', function () { clearInterval(this.pys_fb_timer); this.pys_fb_timer = false; }); } }); // Returns array of elements with given tag name function getTagsAsArr_(tagName) { return [].slice.call(document.getElementsByTagName(tagName)); } // Determine if the element is a Vimeo video or not function checkIfVimeoVideo(potentialVimeoVideo) { var potentialVimeoVideoSrc = potentialVimeoVideo.src || ''; return potentialVimeoVideoSrc.indexOf('player.vimeo.com/video/') > -1; } // Returns key/value pairs of percentages: number of seconds to achieve function getMarks(duration) { var marks = {}; var points = [0,10,50,90,100]; for (var i = 0; i < points.length; i++) { var _point = points[i]; var _mark = _point + '%'; var _time = duration * _point / 100; if ( _point === 100 ) { _time = _time - 1; } // 10% => 123 marks[_mark] = Math.floor(_time); } return marks; } function checkCompletion(player) { player.getCurrentTime().then(function (seconds) { player.pys_fb_now = seconds; }).catch(function(error) { console.error(error); }); player.getDuration().then(function (seconds) { player.pys_fb_duration = seconds; }).catch(function(error) { console.error(error); }); player.getVideoTitle().then(function (title) { player.pys_fb_title = title; }).catch(function(error) { console.error(error); player.pys_fb_title = 'N/A'; }); player.getVideoId().then(function (id) { player.pys_fb_id = id; }).catch(function(error) { console.error(error); player.pys_fb_id = 'N/A'; }); if ( typeof player.pys_fb_now === 'undefined' || typeof player.pys_fb_duration === 'undefined' ) { return; } var marks = getMarks(player.pys_fb_duration); player.pys_fb_marks = player.pys_fb_marks || {}; for (var key in marks) { if (marks[key] <= player.pys_fb_now && !player.pys_fb_marks[key]) { player.pys_fb_marks[key] = true; $(document).trigger('pys_vimeo_watch_video', { video_id: player.pys_fb_id, video_title: player.pys_fb_title, event_trigger: key }); } } } $(document).on('pys_vimeo_watch_video', function (e, data) { if (data.event_trigger === '0%') { data.event_trigger = 'play'; } if (typeof pys_fb_event !== 'undefined') { pys_fb_event(data, 'WatchVideo'); } }); })(document, window, jQuery); // source --> https://www.asiplanning.com.au/wp-content/plugins/pixelyoursite-pro/js/adsense-track.js?ver=6.5.2 //@see: https://www.bennadel.com/blog/1752-tracking-google-adsense-clicks-with-jquery-and-coldfusion.htm (function (document, window, $) { var isOverGoogleAd = false; $(document) .on('mouseover', 'ins > ins > iframe', function () { isOverGoogleAd = true; }) .on('mouseout', 'iframe', function () { isOverGoogleAd = false; }); $(window) .blur( function () { if (isOverGoogleAd) { $(document).trigger('pys_adsense_click', {}); } }) .focus(); // Adsense Event if (pys_fb_pixel_options.adsense_enabled) { $(document).on('pys_adsense_click', function (e, data) { pys_fb_event(data, 'AdSense'); }); } })(document, window, jQuery); // source --> https://www.asiplanning.com.au/wp-includes/js/plupload/moxie.min.js?ver=1.3.5 var MXI_DEBUG=!1;!function(a,b){"use strict";function c(a,b){for(var c,d=[],f=0;f0&&c(f,function(c,f){c!==e&&(a(d[f])===a(c)&&~g(a(c),["array","object"])?b(d[f],c):d[f]=c)})}),d},c=function(b,c){var d,e,f;if(b)if("number"===a(b.length)){for(f=0,d=b.length;fb[d]){f=1;break}}if(!c)return f;switch(c){case">":case"gt":return f>0;case">=":case"ge":return f>=0;case"<=":case"le":return f<=0;case"==":case"=":case"eq":return 0===f;case"<>":case"!=":case"ne":return 0!==f;case"":case"<":case"lt":return f<0;default:return null}}var c=function(a){var b="",c="?",d="function",e="undefined",f="object",g="name",h="version",i={has:function(a,b){return b.toLowerCase().indexOf(a.toLowerCase())!==-1},lowerize:function(a){return a.toLowerCase()}},j={rgx:function(){for(var b,c,g,h,i,j,k,l=0,m=arguments;l0?2==i.length?typeof i[1]==d?b[i[0]]=i[1].call(this,k):b[i[0]]=i[1]:3==i.length?typeof i[1]!==d||i[1].exec&&i[1].test?b[i[0]]=k?k.replace(i[1],i[2]):a:b[i[0]]=k?i[1].call(this,k,i[2]):a:4==i.length&&(b[i[0]]=k?i[3].call(this,k.replace(i[1],i[2])):a):b[i]=k?k:a;break}if(j)break}return b},str:function(b,d){for(var e in d)if(typeof d[e]===f&&d[e].length>0){for(var g=0;g=9)},use_data_uri_of:function(a){return b.use_data_uri&&a<33e3||b.use_data_uri_over32kb()},use_fileinput:function(){if(navigator.userAgent.match(/(Android (1.0|1.1|1.5|1.6|2.0|2.1))|(Windows Phone (OS 7|8.0))|(XBLWP)|(ZuneWP)|(w(eb)?OSBrowser)|(webOS)|(Kindle\/(1.0|2.0|2.5|3.0))/))return!1;var a=document.createElement("input");return a.setAttribute("type","file"),!a.disabled}};return function(c){var d=[].slice.call(arguments);return d.shift(),"function"===a.typeOf(b[c])?b[c].apply(this,d):!!b[c]}}(),e=(new c).getResult(),f={can:d,uaParser:c,browser:e.browser.name,version:e.browser.version,os:e.os.name,osVersion:e.os.version,verComp:b,global_event_dispatcher:"moxie.core.EventTarget.instance.dispatchEvent"};return f.OS=f.os,MXI_DEBUG&&(f.debug={runtime:!0,events:!1},f.log=function(){function b(a){d.appendChild(document.createTextNode(a+"\n"))}var c=arguments[0];if("string"===a.typeOf(c)&&(c=a.sprintf.apply(this,arguments)),window&&window.console&&window.console.log)window.console.log(c);else if(document){var d=document.getElementById("moxie-console");d||(d=document.createElement("pre"),d.id="moxie-console",document.body.appendChild(d)),a.inArray(a.typeOf(c),["object","array"])!==-1?b(c):d.appendChild(document.createTextNode(c+"\n"))}}),f}),d("moxie/core/I18n",["moxie/core/utils/Basic"],function(a){var b={};return{addI18n:function(c){return a.extend(b,c)},translate:function(a){return b[a]||a},_:function(a){return this.translate(a)},sprintf:function(b){var c=[].slice.call(arguments,1);return b.replace(/%[a-z]/g,function(){var b=c.shift();return"undefined"!==a.typeOf(b)?b:""})}}}),d("moxie/core/utils/Mime",["moxie/core/utils/Basic","moxie/core/I18n"],function(a,b){var c="application/msword,doc dot,application/pdf,pdf,application/pgp-signature,pgp,application/postscript,ps ai eps,application/rtf,rtf,application/vnd.ms-excel,xls xlb,application/vnd.ms-powerpoint,ppt pps pot,application/zip,zip,application/x-shockwave-flash,swf swfl,application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx,application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx,application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx,application/vnd.openxmlformats-officedocument.presentationml.template,potx,application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx,application/x-javascript,js,application/json,json,audio/mpeg,mp3 mpga mpega mp2,audio/x-wav,wav,audio/x-m4a,m4a,audio/ogg,oga ogg,audio/aiff,aiff aif,audio/flac,flac,audio/aac,aac,audio/ac3,ac3,audio/x-ms-wma,wma,image/bmp,bmp,image/gif,gif,image/jpeg,jpg jpeg jpe,image/photoshop,psd,image/png,png,image/svg+xml,svg svgz,image/tiff,tiff tif,text/plain,asc txt text diff log,text/html,htm html xhtml,text/css,css,text/csv,csv,text/rtf,rtf,video/mpeg,mpeg mpg mpe m2v,video/quicktime,qt mov,video/mp4,mp4,video/x-m4v,m4v,video/x-flv,flv,video/x-ms-wmv,wmv,video/avi,avi,video/webm,webm,video/3gpp,3gpp 3gp,video/3gpp2,3g2,video/vnd.rn-realvideo,rv,video/ogg,ogv,video/x-matroska,mkv,application/vnd.oasis.opendocument.formula-template,otf,application/octet-stream,exe",d={mimes:{},extensions:{},addMimeType:function(a){var b,c,d,e=a.split(/,/);for(b=0;b=0;e--)if(f[e].fn===b){f.splice(e,1);break}}else f=[];f.length||(delete d[this.uid][a],c.isEmptyObj(d[this.uid])&&delete d[this.uid])}},removeAllEventListeners:function(){d[this.uid]&&delete d[this.uid]},dispatchEvent:function(e){var f,g,h,i,j,k={},l=!0;if("string"!==c.typeOf(e)){if(i=e,"string"!==c.typeOf(i.type))throw new b.EventException(b.EventException.UNSPECIFIED_EVENT_TYPE_ERR);e=i.type,i.total!==j&&i.loaded!==j&&(k.total=i.total,k.loaded=i.loaded),k.async=i.async||!1}if(e.indexOf("::")!==-1?!function(a){f=a[0],e=a[1]}(e.split("::")):f=this.uid,e=e.toLowerCase(),g=d[f]&&d[f][e]){g.sort(function(a,b){return b.priority-a.priority}),h=[].slice.call(arguments),h.shift(),k.type=e,h.unshift(k),MXI_DEBUG&&a.debug.events&&a.log("Event '%s' fired on %u",k.type,f);var m=[];c.each(g,function(a){h[0].target=a.scope,k.async?m.push(function(b){setTimeout(function(){b(a.fn.apply(a.scope,h)===!1)},1)}):m.push(function(b){b(a.fn.apply(a.scope,h)===!1)})}),m.length&&c.inSeries(m,function(a){l=!a})}return l},bind:function(){this.addEventListener.apply(this,arguments)},unbind:function(){this.removeEventListener.apply(this,arguments)},unbindAll:function(){this.removeAllEventListeners.apply(this,arguments)},trigger:function(){return this.dispatchEvent.apply(this,arguments)},handleEventProps:function(a){var b=this;this.bind(a.join(" "),function(a){var b="on"+a.type.toLowerCase();"function"===c.typeOf(this[b])&&this[b].apply(this,arguments)}),c.each(a,function(a){a="on"+a.toLowerCase(a),"undefined"===c.typeOf(b[a])&&(b[a]=null)})}})}return d.instance=new d,d}),d("moxie/runtime/Runtime",["moxie/core/utils/Env","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/EventTarget"],function(a,b,c,d){function e(d,f,h,i,j){var k,l=this,m=b.guid(f+"_"),n=j||"browser";d=d||{},g[m]=this,h=b.extend({access_binary:!1,access_image_binary:!1,display_media:!1,do_cors:!1,drag_and_drop:!1,filter_by_extension:!0,resize_image:!1,report_upload_progress:!1,return_response_headers:!1,return_response_type:!1,return_status_code:!0,send_custom_headers:!1,select_file:!1,select_folder:!1,select_multiple:!0,send_binary_string:!1,send_browser_cookies:!0,send_multipart:!0,slice_blob:!1,stream_upload:!1,summon_file_dialog:!1,upload_filesize:!0,use_http_method:!0},h),d.preferred_caps&&(n=e.getMode(i,d.preferred_caps,n)),MXI_DEBUG&&a.debug.runtime&&a.log("\tdefault mode: %s",n),k=function(){var a={};return{exec:function(b,c,d,e){if(k[c]&&(a[b]||(a[b]={context:this,instance:new k[c]}),a[b].instance[d]))return a[b].instance[d].apply(this,e)},removeInstance:function(b){delete a[b]},removeAllInstances:function(){var c=this;b.each(a,function(a,d){"function"===b.typeOf(a.instance.destroy)&&a.instance.destroy.call(a.context),c.removeInstance(d)})}}}(),b.extend(this,{initialized:!1,uid:m,type:f,mode:e.getMode(i,d.required_caps,n),shimid:m+"_container",clients:0,options:d,can:function(a,c){var d=arguments[2]||h;if("string"===b.typeOf(a)&&"undefined"===b.typeOf(c)&&(a=e.parseCaps(a)),"object"===b.typeOf(a)){for(var f in a)if(!this.can(f,a[f],d))return!1;return!0}return"function"===b.typeOf(d[a])?d[a].call(this,c):c===d[a]},getShimContainer:function(){var a,d=c.get(this.shimid);return d||(a=this.options.container?c.get(this.options.container):document.body,d=document.createElement("div"),d.id=this.shimid,d.className="moxie-shim moxie-shim-"+this.type,b.extend(d.style,{position:"absolute",top:"0px",left:"0px",width:"1px",height:"1px",overflow:"hidden"}),a.appendChild(d),a=null),d},getShim:function(){return k},shimExec:function(a,b){var c=[].slice.call(arguments,2);return l.getShim().exec.call(this,this.uid,a,b,c)},exec:function(a,b){var c=[].slice.call(arguments,2);return l[a]&&l[a][b]?l[a][b].apply(this,c):l.shimExec.apply(this,arguments)},destroy:function(){if(l){var a=c.get(this.shimid);a&&a.parentNode.removeChild(a),k&&k.removeAllInstances(),this.unbindAll(),delete g[this.uid],this.uid=null,m=l=k=a=null}}}),this.mode&&d.required_caps&&!this.can(d.required_caps)&&(this.mode=!1)}var f={},g={};return e.order="html5,html4",e.getRuntime=function(a){return!!g[a]&&g[a]},e.addConstructor=function(a,b){b.prototype=d.instance,f[a]=b},e.getConstructor=function(a){return f[a]||null},e.getInfo=function(a){var b=e.getRuntime(a);return b?{uid:b.uid,type:b.type,mode:b.mode,can:function(){return b.can.apply(b,arguments)}}:null},e.parseCaps=function(a){var c={};return"string"!==b.typeOf(a)?a||{}:(b.each(a.split(","),function(a){c[a]=!0}),c)},e.can=function(a,b){var c,d,f=e.getConstructor(a);return!!f&&(c=new f({required_caps:b}),d=c.mode,c.destroy(),!!d)},e.thatCan=function(a,b){var c=(b||e.order).split(/\s*,\s*/);for(var d in c)if(e.can(c[d],a))return c[d];return null},e.getMode=function(c,d,e){var f=null;if("undefined"===b.typeOf(e)&&(e="browser"),d&&!b.isEmptyObj(c)){if(b.each(d,function(d,e){if(c.hasOwnProperty(e)){var g=c[e](d);if("string"==typeof g&&(g=[g]),f){if(!(f=b.arrayIntersect(f,g)))return MXI_DEBUG&&a.debug.runtime&&a.log("\t\t%c: %v (conflicting mode requested: %s)",e,d,g),f=!1}else f=g}MXI_DEBUG&&a.debug.runtime&&a.log("\t\t%c: %v (compatible modes: %s)",e,d,f)}),f)return b.inArray(e,f)!==-1?e:f[0];if(f===!1)return!1}return e},e.capTrue=function(){return!0},e.capFalse=function(){return!1},e.capTest=function(a){return function(){return!!a}},e}),d("moxie/runtime/RuntimeClient",["moxie/core/utils/Env","moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/Runtime"],function(a,b,c,d){return function(){var e;c.extend(this,{connectRuntime:function(f){function g(c){var h,j;return c.length?(h=c.shift().toLowerCase(),(j=d.getConstructor(h))?(MXI_DEBUG&&a.debug.runtime&&(a.log("Trying runtime: %s",h),a.log(f)),e=new j(f),e.bind("Init",function(){e.initialized=!0,MXI_DEBUG&&a.debug.runtime&&a.log("Runtime '%s' initialized",e.type),setTimeout(function(){e.clients++,i.trigger("RuntimeInit",e)},1)}),e.bind("Error",function(){MXI_DEBUG&&a.debug.runtime&&a.log("Runtime '%s' failed to initialize",e.type),e.destroy(),g(c)}),MXI_DEBUG&&a.debug.runtime&&a.log("\tselected mode: %s",e.mode),e.mode?void e.init():void e.trigger("Error")):void g(c)):(i.trigger("RuntimeError",new b.RuntimeError(b.RuntimeError.NOT_INIT_ERR)),void(e=null))}var h,i=this;if("string"===c.typeOf(f)?h=f:"string"===c.typeOf(f.ruid)&&(h=f.ruid),h){if(e=d.getRuntime(h))return e.clients++,e;throw new b.RuntimeError(b.RuntimeError.NOT_INIT_ERR)}g((f.runtime_order||d.order).split(/\s*,\s*/))},disconnectRuntime:function(){e&&--e.clients<=0&&e.destroy(),e=null},getRuntime:function(){return e&&e.uid?e:e=null},exec:function(){return e?e.exec.apply(this,arguments):null}})}}),d("moxie/file/FileInput",["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/utils/Mime","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/I18n","moxie/runtime/Runtime","moxie/runtime/RuntimeClient"],function(a,b,c,d,e,f,g,h,i){function j(f){MXI_DEBUG&&b.log("Instantiating FileInput...");var j,l,m,n=this;if(a.inArray(a.typeOf(f),["string","node"])!==-1&&(f={browse_button:f}),l=d.get(f.browse_button),!l)throw new e.DOMException(e.DOMException.NOT_FOUND_ERR);m={accept:[{title:g.translate("All Files"),extensions:"*"}],name:"file",multiple:!1,required_caps:!1,container:l.parentNode||document.body},f=a.extend({},m,f),"string"==typeof f.required_caps&&(f.required_caps=h.parseCaps(f.required_caps)),"string"==typeof f.accept&&(f.accept=c.mimes2extList(f.accept)),j=d.get(f.container),j||(j=document.body),"static"===d.getStyle(j,"position")&&(j.style.position="relative"),j=l=null,i.call(n),a.extend(n,{uid:a.guid("uid_"),ruid:null,shimid:null,files:null,init:function(){n.bind("RuntimeInit",function(b,c){n.ruid=c.uid,n.shimid=c.shimid,n.bind("Ready",function(){n.trigger("Refresh")},999),n.bind("Refresh",function(){var b,e,g,h;g=d.get(f.browse_button),h=d.get(c.shimid),g&&(b=d.getPos(g,d.get(f.container)),e=d.getSize(g),h&&a.extend(h.style,{top:b.y+"px",left:b.x+"px",width:e.w+"px",height:e.h+"px"})),h=g=null}),c.exec.call(n,"FileInput","init",f)}),n.connectRuntime(a.extend({},f,{required_caps:{select_file:!0}}))},disable:function(b){var c=this.getRuntime();c&&c.exec.call(this,"FileInput","disable","undefined"===a.typeOf(b)||b)},refresh:function(){n.trigger("Refresh")},destroy:function(){var b=this.getRuntime();b&&(b.exec.call(this,"FileInput","destroy"),this.disconnectRuntime()),"array"===a.typeOf(this.files)&&a.each(this.files,function(a){a.destroy()}),this.files=null,this.unbindAll()}}),this.handleEventProps(k)}var k=["ready","change","cancel","mouseenter","mouseleave","mousedown","mouseup"];return j.prototype=f.instance,j}),d("moxie/core/utils/Encode",[],function(){var a=function(a){return unescape(encodeURIComponent(a))},b=function(a){return decodeURIComponent(escape(a))},c=function(a,c){if("function"==typeof window.atob)return c?b(window.atob(a)):window.atob(a);var d,e,f,g,h,i,j,k,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,n=0,o="",p=[];if(!a)return a;a+="";do g=l.indexOf(a.charAt(m++)),h=l.indexOf(a.charAt(m++)),i=l.indexOf(a.charAt(m++)),j=l.indexOf(a.charAt(m++)),k=g<<18|h<<12|i<<6|j,d=k>>16&255,e=k>>8&255,f=255&k,64==i?p[n++]=String.fromCharCode(d):64==j?p[n++]=String.fromCharCode(d,e):p[n++]=String.fromCharCode(d,e,f);while(m>18&63,h=k>>12&63,i=k>>6&63,j=63&k,p[n++]=l.charAt(g)+l.charAt(h)+l.charAt(i)+l.charAt(j);while(m0?(H&&h.upload.dispatchEvent(b),h.dispatchEvent(b)):(J=!0,h.dispatchEvent("error")),d()}),x.bind("Abort",function(a){h.dispatchEvent(a),d()}),x.bind("Error",function(a){J=!0,c("readyState",n.DONE),h.dispatchEvent("readystatechange"),I=!0,h.dispatchEvent(a),d()}),e.exec.call(x,"XMLHttpRequest","send",{url:r,method:s,async:B,user:t,password:u,headers:C,mimeType:E,encoding:D,responseType:h.responseType,withCredentials:h.withCredentials,options:N},b)}var h=this;v=(new Date).getTime(),x=new g,"string"==typeof N.required_caps&&(N.required_caps=f.parseCaps(N.required_caps)),N.required_caps=a.extend({},N.required_caps,{return_response_type:h.responseType}),b instanceof j&&(N.required_caps.send_multipart=!0),a.isEmptyObj(C)||(N.required_caps.send_custom_headers=!0),K||(N.required_caps.do_cors=!0),N.ruid?e(x.connectRuntime(N)):(x.bind("RuntimeInit",function(a,b){e(b)}),x.bind("RuntimeError",function(a,b){h.dispatchEvent("RuntimeError",b)}),x.connectRuntime(N))}function q(){c("responseText",""),c("responseXML",null),c("response",null),c("status",0),c("statusText",""),v=w=null}var r,s,t,u,v,w,x,y,z=this,A={timeout:0,readyState:n.UNSENT,withCredentials:!1,status:0,statusText:"",responseType:"",responseXML:null,responseText:null,response:null},B=!0,C={},D=null,E=null,F=!1,G=!1,H=!1,I=!1,J=!1,K=!1,L=null,M=null,N={},O="";a.extend(this,A,{uid:a.guid("uid_"),upload:new m,open:function(f,g,h,i,j){var k;if(!f||!g)throw new b.DOMException(b.DOMException.SYNTAX_ERR);if(/[\u0100-\uffff]/.test(f)||d.utf8_encode(f)!==f)throw new b.DOMException(b.DOMException.SYNTAX_ERR);if(~a.inArray(f.toUpperCase(),["CONNECT","DELETE","GET","HEAD","OPTIONS","POST","PUT","TRACE","TRACK"])&&(s=f.toUpperCase()),~a.inArray(s,["CONNECT","TRACE","TRACK"]))throw new b.DOMException(b.DOMException.SECURITY_ERR);if(g=d.utf8_encode(g),k=e.parseUrl(g),K=e.hasSameOrigin(k),r=e.resolveUrl(g),(i||j)&&!K)throw new b.DOMException(b.DOMException.INVALID_ACCESS_ERR);if(t=i||k.user,u=j||k.pass,B=h||!0,B===!1&&(c("timeout")||c("withCredentials")||""!==c("responseType")))throw new b.DOMException(b.DOMException.INVALID_ACCESS_ERR);F=!B,G=!1,C={},q.call(this),c("readyState",n.OPENED),this.dispatchEvent("readystatechange")},setRequestHeader:function(e,f){var g=["accept-charset","accept-encoding","access-control-request-headers","access-control-request-method","connection","content-length","cookie","cookie2","content-transfer-encoding","date","expect","host","keep-alive","origin","referer","te","trailer","transfer-encoding","upgrade","user-agent","via"];if(c("readyState")!==n.OPENED||G)throw new b.DOMException(b.DOMException.INVALID_STATE_ERR);if(/[\u0100-\uffff]/.test(e)||d.utf8_encode(e)!==e)throw new b.DOMException(b.DOMException.SYNTAX_ERR);return e=a.trim(e).toLowerCase(),!~a.inArray(e,g)&&!/^(proxy\-|sec\-)/.test(e)&&(C[e]?C[e]+=", "+f:C[e]=f,!0)},getAllResponseHeaders:function(){return O||""},getResponseHeader:function(b){return b=b.toLowerCase(),J||~a.inArray(b,["set-cookie","set-cookie2"])?null:O&&""!==O&&(y||(y={},a.each(O.split(/\r\n/),function(b){var c=b.split(/:\s+/);2===c.length&&(c[0]=a.trim(c[0]),y[c[0].toLowerCase()]={header:c[0],value:a.trim(c[1])})})),y.hasOwnProperty(b))?y[b].header+": "+y[b].value:null},overrideMimeType:function(d){var e,f;if(~a.inArray(c("readyState"),[n.LOADING,n.DONE]))throw new b.DOMException(b.DOMException.INVALID_STATE_ERR);if(d=a.trim(d.toLowerCase()),/;/.test(d)&&(e=d.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))&&(d=e[1],e[2]&&(f=e[2])),!l.mimes[d])throw new b.DOMException(b.DOMException.SYNTAX_ERR);L=d,M=f},send:function(c,e){if(N="string"===a.typeOf(e)?{ruid:e}:e?e:{},this.readyState!==n.OPENED||G)throw new b.DOMException(b.DOMException.INVALID_STATE_ERR);if(c instanceof h)N.ruid=c.ruid,E=c.type||"application/octet-stream";else if(c instanceof j){if(c.hasBlob()){var f=c.getBlob();N.ruid=f.ruid,E=f.type||"application/octet-stream"}}else"string"==typeof c&&(D="UTF-8",E="text/plain;charset=UTF-8",c=d.utf8_encode(c));this.withCredentials||(this.withCredentials=N.required_caps&&N.required_caps.send_browser_cookies&&!K),H=!F&&this.upload.hasEventListener(),J=!1,I=!c,F||(G=!0),i.call(this,c)},abort:function(){if(J=!0,F=!1,~a.inArray(c("readyState"),[n.UNSENT,n.OPENED,n.DONE]))c("readyState",n.UNSENT);else{if(c("readyState",n.DONE),G=!1,!x)throw new b.DOMException(b.DOMException.INVALID_STATE_ERR);x.getRuntime().exec.call(x,"XMLHttpRequest","abort",I),I=!0}},destroy:function(){x&&("function"===a.typeOf(x.destroy)&&x.destroy(),x=null),this.unbindAll(),this.upload&&(this.upload.unbindAll(),this.upload=null)}}),this.handleEventProps(p.concat(["readystatechange"])),this.upload.handleEventProps(p)}var o={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",306:"Reserved",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",426:"Upgrade Required",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",510:"Not Extended"};m.prototype=c.instance;var p=["loadstart","progress","abort","error","load","timeout","loadend"];return n.UNSENT=0,n.OPENED=1,n.HEADERS_RECEIVED=2,n.LOADING=3,n.DONE=4,n.prototype=c.instance,n}),d("moxie/runtime/Transporter",["moxie/core/utils/Basic","moxie/core/utils/Encode","moxie/runtime/RuntimeClient","moxie/core/EventTarget"],function(a,b,c,d){function e(){function d(){k=l=0,j=this.result=null}function f(b,c){var d=this;i=c,d.bind("TransportingProgress",function(b){l=b.loaded,ld&&(m=d),a=b.btoa(j.substr(l,m)),i.exec.call(c,"Transporter","receive",a,k)}var h,i,j,k,l,m;c.call(this),a.extend(this,{uid:a.guid("uid_"),state:e.IDLE,result:null,transport:function(b,c,e){var g=this;if(e=a.extend({chunk_size:204798},e),(h=e.chunk_size%3)&&(e.chunk_size+=3-h),m=e.chunk_size,d.call(this),j=b,k=b.length,"string"===a.typeOf(e)||e.ruid)f.call(g,c,this.connectRuntime(e));else{var i=function(a,b){g.unbind("RuntimeInit",i),f.call(g,c,b)};this.bind("RuntimeInit",i),this.connectRuntime(e)}},abort:function(){var a=this;a.state=e.IDLE,i&&(i.exec.call(a,"Transporter","clear"),a.trigger("TransportingAborted")),d.call(a)},destroy:function(){this.unbindAll(),i=null,this.disconnectRuntime(),d.call(this)}})}return e.IDLE=0,e.BUSY=1,e.DONE=2,e.prototype=d.instance,e}),d("moxie/image/Image",["moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/file/FileReaderSync","moxie/xhr/XMLHttpRequest","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/runtime/Transporter","moxie/core/utils/Env","moxie/core/EventTarget","moxie/file/Blob","moxie/file/File","moxie/core/utils/Encode"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){function n(){function d(a){a||(a=this.exec("Image","getInfo")),this.size=a.size,this.width=a.width,this.height=a.height,this.type=a.type,this.meta=a.meta,""===this.name&&(this.name=a.name)}function j(b){var d=a.typeOf(b);try{if(b instanceof n){if(!b.size)throw new c.DOMException(c.DOMException.INVALID_STATE_ERR);p.apply(this,arguments)}else if(b instanceof k){if(!~a.inArray(b.type,["image/jpeg","image/png"]))throw new c.ImageError(c.ImageError.WRONG_FORMAT);q.apply(this,arguments)}else if(a.inArray(d,["blob","file"])!==-1)j.call(this,new l(null,b),arguments[1]);else if("string"===d)"data:"===b.substr(0,5)?j.call(this,new k(null,{data:b}),arguments[1]):r.apply(this,arguments);else{if("node"!==d||"img"!==b.nodeName.toLowerCase())throw new c.DOMException(c.DOMException.TYPE_MISMATCH_ERR);j.call(this,b.src,arguments[1])}}catch(e){this.trigger("error",e.code)}}function p(b,c){var d=this.connectRuntime(b.ruid);this.ruid=d.uid,d.exec.call(this,"Image","loadFromImage",b,"undefined"===a.typeOf(c)||c)}function q(b,c){function d(a){e.ruid=a.uid,a.exec.call(e,"Image","loadFromBlob",b)}var e=this;e.name=b.name||"",b.isDetached()?(this.bind("RuntimeInit",function(a,b){d(b)}),c&&"string"==typeof c.required_caps&&(c.required_caps=f.parseCaps(c.required_caps)),this.connectRuntime(a.extend({required_caps:{access_image_binary:!0,resize_image:!0}},c))):d(this.connectRuntime(b.ruid))}function r(a,b){var c,d=this;c=new e,c.open("get",a),c.responseType="blob",c.onprogress=function(a){d.trigger(a)},c.onload=function(){q.call(d,c.response,!0)},c.onerror=function(a){d.trigger(a)},c.onloadend=function(){c.destroy()},c.bind("RuntimeError",function(a,b){d.trigger("RuntimeError",b)}),c.send(null,b)}g.call(this),a.extend(this,{uid:a.guid("uid_"),ruid:null,name:"",size:0,width:0,height:0,type:"",meta:{},clone:function(){this.load.apply(this,arguments)},load:function(){j.apply(this,arguments)},downsize:function(b){var d={width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90,crop:!1,preserveHeaders:!0,resample:!1};b="object"==typeof b?a.extend(d,b):a.extend(d,{width:arguments[0],height:arguments[1],crop:arguments[2],preserveHeaders:arguments[3]});try{if(!this.size)throw new c.DOMException(c.DOMException.INVALID_STATE_ERR);if(this.width>n.MAX_RESIZE_WIDTH||this.height>n.MAX_RESIZE_HEIGHT)throw new c.ImageError(c.ImageError.MAX_RESOLUTION_ERR);this.exec("Image","downsize",b.width,b.height,b.crop,b.preserveHeaders)}catch(e){this.trigger("error",e.code)}},crop:function(a,b,c){this.downsize(a,b,!0,c)},getAsCanvas:function(){if(!i.can("create_canvas"))throw new c.RuntimeError(c.RuntimeError.NOT_SUPPORTED_ERR);var a=this.connectRuntime(this.ruid);return a.exec.call(this,"Image","getAsCanvas")},getAsBlob:function(a,b){if(!this.size)throw new c.DOMException(c.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsBlob",a||"image/jpeg",b||90)},getAsDataURL:function(a,b){if(!this.size)throw new c.DOMException(c.DOMException.INVALID_STATE_ERR);return this.exec("Image","getAsDataURL",a||"image/jpeg",b||90)},getAsBinaryString:function(a,b){var c=this.getAsDataURL(a,b);return m.atob(c.substring(c.indexOf("base64,")+7))},embed:function(d,e){function f(b,e){var f=this;if(i.can("create_canvas")){var k=f.getAsCanvas();if(k)return d.appendChild(k),k=null,f.destroy(),void j.trigger("embedded")}var l=f.getAsDataURL(b,e);if(!l)throw new c.ImageError(c.ImageError.WRONG_FORMAT);if(i.can("use_data_uri_of",l.length))d.innerHTML='',f.destroy(),j.trigger("embedded");else{var n=new h;n.bind("TransportingComplete",function(){g=j.connectRuntime(this.result.ruid),j.bind("Embedded",function(){a.extend(g.getShimContainer().style,{top:"0px",left:"0px",width:f.width+"px",height:f.height+"px"}),g=null},999),g.exec.call(j,"ImageView","display",this.result.uid,width,height),f.destroy()}),n.transport(m.atob(l.substring(l.indexOf("base64,")+7)),b,{required_caps:{display_media:!0},runtime_order:"flash,silverlight",container:d})}}var g,j=this;e=a.extend({width:this.width,height:this.height,type:this.type||"image/jpeg",quality:90},e||{});try{if(!(d=b.get(d)))throw new c.DOMException(c.DOMException.INVALID_NODE_TYPE_ERR);if(!this.size)throw new c.DOMException(c.DOMException.INVALID_STATE_ERR);this.width>n.MAX_RESIZE_WIDTH||this.height>n.MAX_RESIZE_HEIGHT;var k=new n;return k.bind("Resize",function(){f.call(this,e.type,e.quality)}),k.bind("Load",function(){k.downsize(e)}),this.meta.thumb&&this.meta.thumb.width>=e.width&&this.meta.thumb.height>=e.height?k.load(this.meta.thumb.data):k.clone(this,!1),k}catch(l){this.trigger("error",l.code)}},destroy:function(){this.ruid&&(this.getRuntime().exec.call(this,"Image","destroy"),this.disconnectRuntime()),this.unbindAll()}}),this.handleEventProps(o),this.bind("Load Resize",function(){d.call(this)},999)}var o=["progress","load","error","resize","embedded"];return n.MAX_RESIZE_WIDTH=8192,n.MAX_RESIZE_HEIGHT=8192,n.prototype=j.instance,n}),d("moxie/runtime/html5/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(a,b,c,d){function e(b){var e=this,h=c.capTest,i=c.capTrue,j=a.extend({access_binary:h(window.FileReader||window.File&&window.File.getAsDataURL),access_image_binary:function(){return e.can("access_binary")&&!!g.Image},display_media:h(d.can("create_canvas")||d.can("use_data_uri_over32kb")),do_cors:h(window.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest),drag_and_drop:h(function(){var a=document.createElement("div");return("draggable"in a||"ondragstart"in a&&"ondrop"in a)&&("IE"!==d.browser||d.verComp(d.version,9,">"))}()),filter_by_extension:h(function(){return"Chrome"===d.browser&&d.verComp(d.version,28,">=")||"IE"===d.browser&&d.verComp(d.version,10,">=")||"Safari"===d.browser&&d.verComp(d.version,7,">=")}()),return_response_headers:i,return_response_type:function(a){return!("json"!==a||!window.JSON)||d.can("return_response_type",a)},return_status_code:i,report_upload_progress:h(window.XMLHttpRequest&&(new XMLHttpRequest).upload),resize_image:function(){return e.can("access_binary")&&d.can("create_canvas")},select_file:function(){return d.can("use_fileinput")&&window.File},select_folder:function(){return e.can("select_file")&&"Chrome"===d.browser&&d.verComp(d.version,21,">=")},select_multiple:function(){return e.can("select_file")&&!("Safari"===d.browser&&"Windows"===d.os)&&!("iOS"===d.os&&d.verComp(d.osVersion,"7.0.0",">")&&d.verComp(d.osVersion,"8.0.0","<"))},send_binary_string:h(window.XMLHttpRequest&&((new XMLHttpRequest).sendAsBinary||window.Uint8Array&&window.ArrayBuffer)),send_custom_headers:h(window.XMLHttpRequest),send_multipart:function(){return!!(window.XMLHttpRequest&&(new XMLHttpRequest).upload&&window.FormData)||e.can("send_binary_string")},slice_blob:h(window.File&&(File.prototype.mozSlice||File.prototype.webkitSlice||File.prototype.slice)),stream_upload:function(){return e.can("slice_blob")&&e.can("send_multipart")},summon_file_dialog:function(){return e.can("select_file")&&("Firefox"===d.browser&&d.verComp(d.version,4,">=")||"Opera"===d.browser&&d.verComp(d.version,12,">=")||"IE"===d.browser&&d.verComp(d.version,10,">=")||!!~a.inArray(d.browser,["Chrome","Safari"]))},upload_filesize:i},arguments[2]);c.call(this,b,arguments[1]||f,j),a.extend(this,{init:function(){this.trigger("Init")},destroy:function(a){return function(){a.call(e),a=e=null}}(this.destroy)}),a.extend(this.getShim(),g)}var f="html5",g={};return c.addConstructor(f,e),g}),d("moxie/core/utils/Events",["moxie/core/utils/Basic"],function(a){function b(){this.returnValue=!1}function c(){this.cancelBubble=!0}var d={},e="moxie_"+a.guid(),f=function(f,g,h,i){var j,k;g=g.toLowerCase(),f.addEventListener?(j=h,f.addEventListener(g,j,!1)):f.attachEvent&&(j=function(){var a=window.event;a.target||(a.target=a.srcElement),a.preventDefault=b,a.stopPropagation=c,h(a)},f.attachEvent("on"+g,j)),f[e]||(f[e]=a.guid()),d.hasOwnProperty(f[e])||(d[f[e]]={}),k=d[f[e]],k.hasOwnProperty(g)||(k[g]=[]),k[g].push({func:j,orig:h,key:i})},g=function(b,c,f){var g,h;if(c=c.toLowerCase(),b[e]&&d[b[e]]&&d[b[e]][c]){g=d[b[e]][c];for(var i=g.length-1;i>=0&&(g[i].orig!==f&&g[i].key!==f||(b.removeEventListener?b.removeEventListener(c,g[i].func,!1):b.detachEvent&&b.detachEvent("on"+c,g[i].func),g[i].orig=null,g[i].func=null,g.splice(i,1),f===h));i--);if(g.length||delete d[b[e]][c],a.isEmptyObj(d[b[e]])){delete d[b[e]];try{delete b[e]}catch(j){b[e]=h}}}},h=function(b,c){b&&b[e]&&a.each(d[b[e]],function(a,d){g(b,d,c)})};return{addEvent:f,removeEvent:g,removeAllEvents:h}}),d("moxie/runtime/html5/file/FileInput",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(a,b,c,d,e,f,g){function h(){var a;c.extend(this,{init:function(h){var i,j,k,l,m,n,o=this,p=o.getRuntime();a=h,k=a.accept.mimes||f.extList2mimes(a.accept,p.can("filter_by_extension")),j=p.getShimContainer(),j.innerHTML='",i=d.get(p.uid),c.extend(i.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),l=d.get(a.browse_button),p.can("summon_file_dialog")&&("static"===d.getStyle(l,"position")&&(l.style.position="relative"),m=parseInt(d.getStyle(l,"z-index"),10)||1,l.style.zIndex=m,j.style.zIndex=m-1,e.addEvent(l,"click",function(a){var b=d.get(p.uid);b&&!b.disabled&&b.click(),a.preventDefault()},o.uid)),n=p.can("summon_file_dialog")?l:j,e.addEvent(n,"mouseover",function(){o.trigger("mouseenter")},o.uid),e.addEvent(n,"mouseout",function(){o.trigger("mouseleave")},o.uid),e.addEvent(n,"mousedown",function(){o.trigger("mousedown")},o.uid),e.addEvent(d.get(a.container),"mouseup",function(){o.trigger("mouseup")},o.uid),i.onchange=function q(d){if(o.files=[],c.each(this.files,function(c){var d="";return!(!a.directory||"."!=c.name)||(c.webkitRelativePath&&(d="/"+c.webkitRelativePath.replace(/^\//,"")),c=new b(p.uid,c),c.relativePath=d,void o.files.push(c))}),"IE"!==g.browser&&"IEMobile"!==g.browser)this.value="";else{var e=this.cloneNode(!0);this.parentNode.replaceChild(e,this),e.onchange=q}o.files.length&&o.trigger("change")},o.trigger({type:"ready",async:!0}),j=null},disable:function(a){var b,c=this.getRuntime();(b=d.get(c.uid))&&(b.disabled=!!a)},destroy:function(){var b=this.getRuntime(),c=b.getShim(),f=b.getShimContainer();e.removeAllEvents(f,this.uid),e.removeAllEvents(a&&d.get(a.container),this.uid),e.removeAllEvents(a&&d.get(a.browse_button),this.uid),f&&(f.innerHTML=""),c.removeInstance(this.uid),a=f=c=null}})}return a.FileInput=h}),d("moxie/runtime/html5/file/Blob",["moxie/runtime/html5/Runtime","moxie/file/Blob"],function(a,b){function c(){function a(a,b,c){var d;if(!window.File.prototype.slice)return(d=window.File.prototype.webkitSlice||window.File.prototype.mozSlice)?d.call(a,b,c):null;try{return a.slice(),a.slice(b,c)}catch(e){return a.slice(b,c-b)}}this.slice=function(){return new b(this.getRuntime().uid,a.apply(this,arguments))}}return a.Blob=c}),d("moxie/runtime/html5/file/FileDrop",["moxie/runtime/html5/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime"],function(a,b,c,d,e,f){function g(){function a(a){if(!a.dataTransfer||!a.dataTransfer.types)return!1;var b=c.toArray(a.dataTransfer.types||[]);return c.inArray("Files",b)!==-1||c.inArray("public.file-url",b)!==-1||c.inArray("application/x-moz-file",b)!==-1}function g(a,c){if(i(a)){var d=new b(o,a);d.relativePath=c||"",p.push(d)}}function h(a){for(var b=[],d=0;d=")&&i.verComp(i.version,7,"<"),o="Android Browser"===i.browser,p=!1;if(n=c.url.replace(/^.+?\/([\w\-\.]+)$/,"$1").toLowerCase(),m=j(),m.open(c.method,c.url,c.async,c.user,c.password),e instanceof f)e.isDetached()&&(p=!0),e=e.getSource();else if(e instanceof g){if(e.hasBlob())if(e.getBlob().isDetached())e=l.call(h,e),p=!0;else if((k||o)&&"blob"===b.typeOf(e.getBlob().getSource())&&window.FileReader)return void a.call(h,c,e);if(e instanceof g){var q=new window.FormData;e.each(function(a,b){a instanceof f?q.append(b,a.getSource()):q.append(b,a)}),e=q}}m.upload?(c.withCredentials&&(m.withCredentials=!0),m.addEventListener("load",function(a){h.trigger(a)}),m.addEventListener("error",function(a){h.trigger(a)}),m.addEventListener("progress",function(a){h.trigger(a)}),m.upload.addEventListener("progress",function(a){h.trigger({type:"UploadProgress",loaded:a.loaded,total:a.total})})):m.onreadystatechange=function(){switch(m.readyState){case 1:break;case 2:break;case 3:var a,b;try{d.hasSameOrigin(c.url)&&(a=m.getResponseHeader("Content-Length")||0),m.responseText&&(b=m.responseText.length)}catch(e){a=b=0}h.trigger({type:"progress",lengthComputable:!!a,total:parseInt(a,10),loaded:b});break;case 4:m.onreadystatechange=function(){},0===m.status?h.trigger("error"):h.trigger("load")}},b.isEmptyObj(c.headers)||b.each(c.headers,function(a,b){m.setRequestHeader(b,a)}),""!==c.responseType&&"responseType"in m&&("json"!==c.responseType||i.can("return_response_type","json")?m.responseType=c.responseType:m.responseType="text"),p?m.sendAsBinary?m.sendAsBinary(e):!function(){for(var a=new Uint8Array(e.length),b=0;b0&&f.set(new Uint8Array(b.slice(0,a)),0),f.set(new Uint8Array(e),a),f.set(new Uint8Array(b.slice(a+d)),a+e.byteLength),this.clear(),b=f.buffer,c=new DataView(b); break}default:return b}},length:function(){return b?b.byteLength:0},clear:function(){c=b=null}})}function d(b){function c(a,c,d){d=3===arguments.length?d:b.length-c-1,b=b.substr(0,c)+a+b.substr(d+c)}a.extend(this,{readByteAt:function(a){return b.charCodeAt(a)},writeByteAt:function(a,b){c(String.fromCharCode(b),a,1)},SEGMENT:function(a,d,e){switch(arguments.length){case 1:return b.substr(a);case 2:return b.substr(a,d);case 3:c(null!==e?e:"",a,d);break;default:return b}},length:function(){return b?b.length:0},clear:function(){b=null}})}return a.extend(b.prototype,{littleEndian:!1,read:function(a,b){var c,d,e;if(a+b>this.length())throw new Error("You are trying to read outside the source boundaries.");for(d=this.littleEndian?0:-8*(b-1),e=0,c=0;ethis.length())throw new Error("You are trying to write outside the source boundaries.");for(d=this.littleEndian?0:-8*(c-1),e=0;e>Math.abs(d+8*e)&255)},BYTE:function(a){return this.read(a,1)},SHORT:function(a){return this.read(a,2)},LONG:function(a){return this.read(a,4)},SLONG:function(a){var b=this.read(a,4);return b>2147483647?b-4294967296:b},CHAR:function(a){return String.fromCharCode(this.read(a,1))},STRING:function(a,b){return this.asArray("CHAR",a,b).join("")},asArray:function(a,b,c){for(var d=[],e=0;e=65488&&g<=65495)f+=2;else{if(65498===g||65497===g)break;i=e.SHORT(f+2)+2,g>=65505&&g<=65519&&h.push({hex:g,name:"APP"+(15&g),start:f,length:i,segment:e.SEGMENT(f,i)}),f+=i}return e.clear(),{headers:h,restore:function(b){var c,d,e;for(e=new a(b),f=65504==e.SHORT(2)?4+e.SHORT(4):2,d=0,c=h.length;d=f.length));c++);},purge:function(){this.headers=h=[]}}}}),d("moxie/runtime/html5/image/ExifParser",["moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader","moxie/core/Exceptions"],function(a,c,d){function e(f){function g(c,e){var f,g,h,i,j,m,n,o,p=this,q=[],r={},s={1:"BYTE",7:"UNDEFINED",2:"ASCII",3:"SHORT",4:"LONG",5:"RATIONAL",9:"SLONG",10:"SRATIONAL"},t={BYTE:1,UNDEFINED:1,ASCII:1,SHORT:2,LONG:4,RATIONAL:8,SLONG:4,SRATIONAL:8};for(f=p.SHORT(c),g=0;g4&&(n=p.LONG(n)+l.tiffHeader),n+m*j>=this.length())throw new d.ImageError(d.ImageError.INVALID_META_ERR);"ASCII"!==i?(q=p.asArray(i,n,j),o=1==j?q[0]:q,k.hasOwnProperty(h)&&"object"!=typeof o?r[h]=k[h][o]:r[h]=o):r[h]=a.trim(p.STRING(n,j).replace(/\0$/,""))}return r}function h(a,b,c){var d,e,f,g=0;if("string"==typeof b){var h=j[a.toLowerCase()];for(var i in h)if(h[i]===b){b=i;break}}d=l[a.toLowerCase()+"IFD"],e=this.SHORT(d);for(var k=0;k=65472&&b<=65475)return d+=5,{height:a.SHORT(d),width:a.SHORT(d+=2)};c=a.SHORT(d+=2),d+=c-2}return null}function h(){var a,b,c=l.thumb();return c&&(a=new d(c),b=g(a),a.clear(),b)?(b.data=c,b):null}function i(){l&&k&&j&&(l.clear(),k.purge(),j.clear(),m=k=l=j=null)}var j,k,l,m;if(j=new d(f),65496!==j.SHORT(0))throw new b.ImageError(b.ImageError.WRONG_FORMAT);k=new c(f);try{l=new e(k.get("app1")[0])}catch(n){}m=g.call(this),a.extend(this,{type:"image/jpeg",size:j.length(),width:m&&m.width||0,height:m&&m.height||0,setExif:function(b,c){return!!l&&("object"===a.typeOf(b)?a.each(b,function(a,b){l.setExif(b,a)}):l.setExif(b,c),void k.set("app1",l.SEGMENT()))},writeHeaders:function(){return arguments.length?k.restore(arguments[0]):k.restore(f)},stripHeaders:function(a){return k.strip(a)},purge:function(){i.call(this)}}),l&&(this.meta={tiff:l.TIFF(),exif:l.EXIF(),gps:l.GPS(),thumb:h()})}return f}),d("moxie/runtime/html5/image/PNG",["moxie/core/Exceptions","moxie/core/utils/Basic","moxie/runtime/html5/utils/BinaryReader"],function(a,b,c){function d(d){function e(){var a,b;return a=g.call(this,8),"IHDR"==a.type?(b=a.start,{width:h.LONG(b),height:h.LONG(b+=4)}):null}function f(){h&&(h.clear(),d=k=i=j=h=null)}function g(a){var b,c,d,e;return b=h.LONG(a),c=h.STRING(a+=4,4),d=a+=4,e=h.LONG(a+b),{length:b,type:c,start:d,CRC:e}}var h,i,j,k;h=new c(d),function(){var b=0,c=0,d=[35152,20039,3338,6666];for(c=0;cg?g-q:m,s=0;sf?f-s:m;o.clearRect(0,0,m,m),o.drawImage(a,-s,-q);var u=s*h/f+j<<0,v=Math.ceil(t*h/f),w=q*i/g/p+k<<0,x=Math.ceil(r*i/g/p);l.drawImage(n,0,0,t,r,u,w,v,x),s+=m}q+=m}n=o=null}function b(a){var b=a.naturalWidth,c=a.naturalHeight;if(b*c>1048576){var d=document.createElement("canvas");d.width=d.height=1;var e=d.getContext("2d");return e.drawImage(a,-b+1,0),0===e.getImageData(0,0,1,1).data[3]}return!1}function c(a,b,c){var d=document.createElement("canvas");d.width=1,d.height=c;var e=d.getContext("2d");e.drawImage(a,0,0);for(var f=e.getImageData(0,0,1,c).data,g=0,h=c,i=c;i>g;){var j=f[4*(i-1)+3];0===j?h=i:g=i,i=h+g>>1}d=null;var k=i/c;return 0===k?1:k}return{isSubsampled:b,renderTo:a}}),d("moxie/runtime/html5/image/Image",["moxie/runtime/html5/Runtime","moxie/core/utils/Basic","moxie/core/Exceptions","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/File","moxie/runtime/html5/image/ImageInfo","moxie/runtime/html5/image/MegaPixel","moxie/core/utils/Mime","moxie/core/utils/Env"],function(a,b,c,d,e,f,g,h,i,j){function k(){function a(){if(!u&&!s)throw new c.ImageError(c.DOMException.INVALID_STATE_ERR);return u||s}function k(a){return d.atob(a.substring(a.indexOf("base64,")+7))}function l(a,b){return"data:"+(b||"")+";base64,"+d.btoa(a)}function m(a){var b=this;s=new Image,s.onerror=function(){r.call(this),b.trigger("error",c.ImageError.WRONG_FORMAT)},s.onload=function(){b.trigger("load")},s.src="data:"==a.substr(0,5)?a:l(a,w.type)}function n(a,b){var d,e=this;return window.FileReader?(d=new FileReader,d.onload=function(){b(this.result)},d.onerror=function(){e.trigger("error",c.ImageError.WRONG_FORMAT)},d.readAsDataURL(a),void 0):b(a.getAsDataURL())}function o(c,d,e,f){var g,h,i,j,k,l=this,m=0,n=0;if(z=f,k=this.meta&&this.meta.tiff&&this.meta.tiff.Orientation||1,b.inArray(k,[5,6,7,8])!==-1){var o=c;c=d,d=o}return h=a(),e?(c=Math.min(c,h.width),d=Math.min(d,h.height),g=Math.max(c/h.width,d/h.height)):g=Math.min(c/h.width,d/h.height),g>1&&!e&&f?void this.trigger("Resize"):(u||(u=document.createElement("canvas")),i=Math.round(h.width*g),j=Math.round(h.height*g),e?(u.width=c,u.height=d,i>c&&(m=Math.round((i-c)/2)),j>d&&(n=Math.round((j-d)/2))):(u.width=i,u.height=j),z||q(u.width,u.height,k),p.call(this,h,u,-m,-n,i,j),this.width=u.width,this.height=u.height,y=!0,void l.trigger("Resize"))}function p(a,b,c,d,e,f){if("iOS"===j.OS)h.renderTo(a,b,{width:e,height:f,x:c,y:d});else{var g=b.getContext("2d");g.drawImage(a,c,d,e,f)}}function q(a,b,c){switch(c){case 5:case 6:case 7:case 8:u.width=b,u.height=a;break;default:u.width=a,u.height=b}var d=u.getContext("2d");switch(c){case 2:d.translate(a,0),d.scale(-1,1);break;case 3:d.translate(a,b),d.rotate(Math.PI);break;case 4:d.translate(0,b),d.scale(1,-1);break;case 5:d.rotate(.5*Math.PI),d.scale(1,-1);break;case 6:d.rotate(.5*Math.PI),d.translate(0,-b);break;case 7:d.rotate(.5*Math.PI),d.translate(a,-b),d.scale(-1,1);break;case 8:d.rotate(-.5*Math.PI),d.translate(-a,0)}}function r(){t&&(t.purge(),t=null),v=s=u=w=null,y=!1}var s,t,u,v,w,x=this,y=!1,z=!0;b.extend(this,{loadFromBlob:function(a){var b=this,d=b.getRuntime(),e=!(arguments.length>1)||arguments[1];if(!d.can("access_binary"))throw new c.RuntimeError(c.RuntimeError.NOT_SUPPORTED_ERR);return w=a,a.isDetached()?(v=a.getSource(),void m.call(this,v)):void n.call(this,a.getSource(),function(a){e&&(v=k(a)),m.call(b,a)})},loadFromImage:function(a,b){this.meta=a.meta,w=new f(null,{name:a.name,size:a.size,type:a.type}),m.call(this,b?v=a.getAsBinaryString():a.getAsDataURL())},getInfo:function(){var b,c=this.getRuntime();return!t&&v&&c.can("access_image_binary")&&(t=new g(v)),b={width:a().width||0,height:a().height||0,type:w.type||i.getFileMime(w.name),size:v&&v.length||w.size||0,name:w.name||"",meta:t&&t.meta||this.meta||{}},!b.meta||!b.meta.thumb||b.meta.thumb.data instanceof e||(b.meta.thumb.data=new e(null,{type:"image/jpeg",data:b.meta.thumb.data})),b},downsize:function(){o.apply(this,arguments)},getAsCanvas:function(){return u&&(u.id=this.uid+"_canvas"),u},getAsBlob:function(a,b){return a!==this.type&&o.call(this,this.width,this.height,!1),new f(null,{name:w.name||"",type:a,data:x.getAsBinaryString.call(this,a,b)})},getAsDataURL:function(a){var b=arguments[1]||90;if(!y)return s.src;if("image/jpeg"!==a)return u.toDataURL("image/png");try{return u.toDataURL("image/jpeg",b/100)}catch(c){return u.toDataURL("image/jpeg")}},getAsBinaryString:function(a,b){if(!y)return v||(v=k(x.getAsDataURL(a,b))),v;if("image/jpeg"!==a)v=k(x.getAsDataURL(a,b));else{var c;b||(b=90);try{c=u.toDataURL("image/jpeg",b/100)}catch(d){c=u.toDataURL("image/jpeg")}v=k(c),t&&(v=t.stripHeaders(v),z&&(t.meta&&t.meta.exif&&t.setExif({PixelXDimension:this.width,PixelYDimension:this.height}),v=t.writeHeaders(v)),t.purge(),t=null)}return y=!1,v},destroy:function(){x=null,r.call(this),this.getRuntime().getShim().removeInstance(this.uid)}})}return a.Image=k}),d("moxie/runtime/flash/Runtime",[],function(){return{}}),d("moxie/runtime/silverlight/Runtime",[],function(){return{}}),d("moxie/runtime/html4/Runtime",["moxie/core/utils/Basic","moxie/core/Exceptions","moxie/runtime/Runtime","moxie/core/utils/Env"],function(a,b,c,d){function e(b){var e=this,h=c.capTest,i=c.capTrue;c.call(this,b,f,{access_binary:h(window.FileReader||window.File&&File.getAsDataURL),access_image_binary:!1,display_media:h(g.Image&&(d.can("create_canvas")||d.can("use_data_uri_over32kb"))),do_cors:!1,drag_and_drop:!1,filter_by_extension:h(function(){return"Chrome"===d.browser&&d.verComp(d.version,28,">=")||"IE"===d.browser&&d.verComp(d.version,10,">=")||"Safari"===d.browser&&d.verComp(d.version,7,">=")}()),resize_image:function(){return g.Image&&e.can("access_binary")&&d.can("create_canvas")},report_upload_progress:!1,return_response_headers:!1,return_response_type:function(b){return!("json"!==b||!window.JSON)||!!~a.inArray(b,["text","document",""])},return_status_code:function(b){return!a.arrayDiff(b,[200,404])},select_file:function(){return d.can("use_fileinput")},select_multiple:!1,send_binary_string:!1,send_custom_headers:!1,send_multipart:!0,slice_blob:!1,stream_upload:function(){return e.can("select_file")},summon_file_dialog:function(){return e.can("select_file")&&("Firefox"===d.browser&&d.verComp(d.version,4,">=")||"Opera"===d.browser&&d.verComp(d.version,12,">=")||"IE"===d.browser&&d.verComp(d.version,10,">=")||!!~a.inArray(d.browser,["Chrome","Safari"]))},upload_filesize:i,use_http_method:function(b){return!a.arrayDiff(b,["GET","POST"])}}),a.extend(this,{init:function(){this.trigger("Init")},destroy:function(a){return function(){a.call(e),a=e=null}}(this.destroy)}),a.extend(this.getShim(),g)}var f="html4",g={};return c.addConstructor(f,e),g}),d("moxie/runtime/html4/file/FileInput",["moxie/runtime/html4/Runtime","moxie/file/File","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Events","moxie/core/utils/Mime","moxie/core/utils/Env"],function(a,b,c,d,e,f,g){function h(){function a(){var f,k,l,m,n,o,p=this,q=p.getRuntime();o=c.guid("uid_"),f=q.getShimContainer(),h&&(l=d.get(h+"_form"),l&&c.extend(l.style,{top:"100%"})),m=document.createElement("form"),m.setAttribute("id",o+"_form"),m.setAttribute("method","post"),m.setAttribute("enctype","multipart/form-data"),m.setAttribute("encoding","multipart/form-data"),c.extend(m.style,{overflow:"hidden",position:"absolute",top:0,left:0,width:"100%",height:"100%"}),n=document.createElement("input"),n.setAttribute("id",o),n.setAttribute("type","file"),n.setAttribute("name",i.name||"Filedata"),n.setAttribute("accept",j.join(",")),c.extend(n.style,{fontSize:"999px",opacity:0}),m.appendChild(n),f.appendChild(m),c.extend(n.style,{position:"absolute",top:0,left:0,width:"100%",height:"100%"}),"IE"===g.browser&&g.verComp(g.version,10,"<")&&c.extend(n.style,{filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=0)"}),n.onchange=function(){var c;if(this.value){if(this.files){if(c=this.files[0],0===c.size)return void m.parentNode.removeChild(m)}else c={name:this.value};c=new b(q.uid,c),this.onchange=function(){},a.call(p),p.files=[c],n.setAttribute("id",c.uid),m.setAttribute("id",c.uid+"_form"),p.trigger("change"),n=m=null}},q.can("summon_file_dialog")&&(k=d.get(i.browse_button),e.removeEvent(k,"click",p.uid),e.addEvent(k,"click",function(a){n&&!n.disabled&&n.click(),a.preventDefault()},p.uid)),h=o,f=l=k=null}var h,i,j=[];c.extend(this,{init:function(b){var c,g=this,h=g.getRuntime();i=b,j=b.accept.mimes||f.extList2mimes(b.accept,h.can("filter_by_extension")),c=h.getShimContainer(),function(){var a,f,i;a=d.get(b.browse_button),h.can("summon_file_dialog")&&("static"===d.getStyle(a,"position")&&(a.style.position="relative"),f=parseInt(d.getStyle(a,"z-index"),10)||1,a.style.zIndex=f,c.style.zIndex=f-1),i=h.can("summon_file_dialog")?a:c,e.addEvent(i,"mouseover",function(){g.trigger("mouseenter")},g.uid),e.addEvent(i,"mouseout",function(){g.trigger("mouseleave")},g.uid),e.addEvent(i,"mousedown",function(){g.trigger("mousedown")},g.uid),e.addEvent(d.get(b.container),"mouseup",function(){g.trigger("mouseup")},g.uid),a=null}(),a.call(this),c=null,g.trigger({type:"ready",async:!0})},disable:function(a){var b;(b=d.get(h))&&(b.disabled=!!a)},destroy:function(){var a=this.getRuntime(),b=a.getShim(),c=a.getShimContainer();e.removeAllEvents(c,this.uid),e.removeAllEvents(i&&d.get(i.container),this.uid),e.removeAllEvents(i&&d.get(i.browse_button),this.uid),c&&(c.innerHTML=""),b.removeInstance(this.uid),h=j=i=c=b=null}})}return a.FileInput=h}),d("moxie/runtime/html4/file/FileReader",["moxie/runtime/html4/Runtime","moxie/runtime/html5/file/FileReader"],function(a,b){return a.FileReader=b}),d("moxie/runtime/html4/xhr/XMLHttpRequest",["moxie/runtime/html4/Runtime","moxie/core/utils/Basic","moxie/core/utils/Dom","moxie/core/utils/Url","moxie/core/Exceptions","moxie/core/utils/Events","moxie/file/Blob","moxie/xhr/FormData"],function(a,b,c,d,e,f,g,h){function i(){function a(a){var b,d,e,g,h=this,i=!1;if(k){if(b=k.id.replace(/_iframe$/,""),d=c.get(b+"_form")){for(e=d.getElementsByTagName("input"),g=e.length;g--;)switch(e[g].getAttribute("type")){case"hidden":e[g].parentNode.removeChild(e[g]);break;case"file":i=!0}e=[],i||d.parentNode.removeChild(d),d=null}setTimeout(function(){f.removeEvent(k,"load",h.uid),k.parentNode&&k.parentNode.removeChild(k);var b=h.getRuntime().getShimContainer();b.children.length||b.parentNode.removeChild(b),b=k=null,a()},1)}}var i,j,k;b.extend(this,{send:function(l,m){function n(){var c=t.getShimContainer()||document.body,e=document.createElement("div");e.innerHTML='',k=e.firstChild,c.appendChild(k),f.addEvent(k,"load",function(){var c;try{c=k.contentWindow.document||k.contentDocument||window.frames[k.id].document,/^4(0[0-9]|1[0-7]|2[2346])\s/.test(c.title)?i=c.title.replace(/^(\d+).*$/,"$1"):(i=200,j=b.trim(c.body.innerHTML),s.trigger({type:"progress",loaded:j.length,total:j.length}),r&&s.trigger({type:"uploadprogress",loaded:r.size||1025,total:r.size||1025}))}catch(e){if(!d.hasSameOrigin(l.url))return void a.call(s,function(){s.trigger("error")});i=404}a.call(s,function(){s.trigger("load")})},s.uid)}var o,p,q,r,s=this,t=s.getRuntime();if(i=j=null,m instanceof h&&m.hasBlob()){if(r=m.getBlob(),o=r.uid,q=c.get(o),p=c.get(o+"_form"),!p)throw new e.DOMException(e.DOMException.NOT_FOUND_ERR)}else o=b.guid("uid_"),p=document.createElement("form"),p.setAttribute("id",o+"_form"),p.setAttribute("method",l.method),p.setAttribute("enctype","multipart/form-data"),p.setAttribute("encoding","multipart/form-data"),t.getShimContainer().appendChild(p);p.setAttribute("target",o+"_iframe"),m instanceof h&&m.each(function(a,c){if(a instanceof g)q&&q.setAttribute("name",c);else{var d=document.createElement("input");b.extend(d,{type:"hidden",name:c,value:a}),q?p.insertBefore(d,q):p.appendChild(d)}}),p.setAttribute("action",l.url),n(),p.submit(),s.trigger("loadstart")},getStatus:function(){return i},getResponse:function(a){if("json"===a&&"string"===b.typeOf(j)&&window.JSON)try{return JSON.parse(j.replace(/^\s*]*>/,"").replace(/<\/pre>\s*$/,""))}catch(c){return null}return j},abort:function(){var b=this;k&&k.contentWindow&&(k.contentWindow.stop?k.contentWindow.stop():k.contentWindow.document.execCommand?k.contentWindow.document.execCommand("Stop"):k.src="about:blank"),a.call(this,function(){b.dispatchEvent("abort")})}})}return a.XMLHttpRequest=i}),d("moxie/runtime/html4/image/Image",["moxie/runtime/html4/Runtime","moxie/runtime/html5/image/Image"],function(a,b){return a.Image=b}),f(["moxie/core/utils/Basic","moxie/core/utils/Env","moxie/core/I18n","moxie/core/utils/Mime","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/FileInput","moxie/core/utils/Encode","moxie/file/Blob","moxie/file/File","moxie/file/FileDrop","moxie/file/FileReader","moxie/core/utils/Url","moxie/runtime/RuntimeTarget","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/image/Image","moxie/core/utils/Events"])}(this),function(a){"use strict";var b={},c=a.moxie.core.utils.Basic.inArray;return function d(a){var e,f;for(e in a)f=typeof a[e],"object"!==f||~c(e,["Exceptions","Env","Mime"])?"function"===f&&(b[e]=a[e]):d(a[e])}(a.moxie),b.Env=a.moxie.core.utils.Env,b.Mime=a.moxie.core.utils.Mime,b.Exceptions=a.moxie.core.Exceptions,a.mOxie=b,a.o||(a.o=b),b}(this); // source --> https://www.asiplanning.com.au/wp-includes/js/plupload/plupload.min.js?ver=2.1.9 !function(a,b,c){function d(a){function b(a,b,c){var e={chunks:"slice_blob",jpgresize:"send_binary_string",pngresize:"send_binary_string",progress:"report_upload_progress",multi_selection:"select_multiple",dragdrop:"drag_and_drop",drop_element:"drag_and_drop",headers:"send_custom_headers",urlstream_upload:"send_binary_string",canSendBinary:"send_binary",triggerDialog:"summon_file_dialog"};e[a]?d[e[a]]=b:c||(d[a]=b)}var c=a.required_features,d={};return"string"==typeof c?g.each(c.split(/\s*,\s*/),function(a){b(a,!0)}):"object"==typeof c?g.each(c,function(a,c){b(c,a)}):c===!0&&(a.chunk_size>0&&(d.slice_blob=!0),!a.resize.enabled&&a.multipart||(d.send_binary_string=!0),g.each(a,function(a,c){b(c,!!a,!0)})),a.runtimes="html5,html4",d}var e=a.setTimeout,f={},g={VERSION:"2.1.9",STOPPED:1,STARTED:2,QUEUED:1,UPLOADING:2,FAILED:4,DONE:5,GENERIC_ERROR:-100,HTTP_ERROR:-200,IO_ERROR:-300,SECURITY_ERROR:-400,INIT_ERROR:-500,FILE_SIZE_ERROR:-600,FILE_EXTENSION_ERROR:-601,FILE_DUPLICATE_ERROR:-602,IMAGE_FORMAT_ERROR:-700,MEMORY_ERROR:-701,IMAGE_DIMENSIONS_ERROR:-702,mimeTypes:b.mimes,ua:b.ua,typeOf:b.typeOf,extend:b.extend,guid:b.guid,getAll:function(a){var b,c=[];"array"!==g.typeOf(a)&&(a=[a]);for(var d=a.length;d--;)b=g.get(a[d]),b&&c.push(b);return c.length?c:null},get:b.get,each:b.each,getPos:b.getPos,getSize:b.getSize,xmlEncode:function(a){var b={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},c=/[<>&\"\']/g;return a?(""+a).replace(c,function(a){return b[a]?"&"+b[a]+";":a}):a},toArray:b.toArray,inArray:b.inArray,addI18n:b.addI18n,translate:b.translate,isEmptyObj:b.isEmptyObj,hasClass:b.hasClass,addClass:b.addClass,removeClass:b.removeClass,getStyle:b.getStyle,addEvent:b.addEvent,removeEvent:b.removeEvent,removeAllEvents:b.removeAllEvents,cleanName:function(a){var b,c;for(c=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"],b=0;b0?"&":"?")+c),a},formatSize:function(a){function b(a,b){return Math.round(a*Math.pow(10,b))/Math.pow(10,b)}if(a===c||/\D/.test(a))return g.translate("N/A");var d=Math.pow(1024,4);return a>d?b(a/d,1)+" "+g.translate("tb"):a>(d/=1024)?b(a/d,1)+" "+g.translate("gb"):a>(d/=1024)?b(a/d,1)+" "+g.translate("mb"):a>1024?Math.round(a/1024)+" "+g.translate("kb"):a+" "+g.translate("b")},parseSize:b.parseSizeStr,predictRuntime:function(a,c){var d,e;return d=new g.Uploader(a),e=b.Runtime.thatCan(d.getOption().required_features,c||a.runtimes),d.destroy(),e},addFileFilter:function(a,b){f[a]=b}};g.addFileFilter("mime_types",function(a,b,c){a.length&&!a.regexp.test(b.name)?(this.trigger("Error",{code:g.FILE_EXTENSION_ERROR,message:g.translate("File extension error."),file:b}),c(!1)):c(!0)}),g.addFileFilter("max_file_size",function(a,b,c){var d;a=g.parseSize(a),b.size!==d&&a&&b.size>a?(this.trigger("Error",{code:g.FILE_SIZE_ERROR,message:g.translate("File size error."),file:b}),c(!1)):c(!0)}),g.addFileFilter("prevent_duplicates",function(a,b,c){if(a)for(var d=this.files.length;d--;)if(b.name===this.files[d].name&&b.size===this.files[d].size)return this.trigger("Error",{code:g.FILE_DUPLICATE_ERROR,message:g.translate("Duplicate file error."),file:b}),void c(!1);c(!0)}),g.Uploader=function(a){function h(){var a,b,c=0;if(this.state==g.STARTED){for(b=0;b0?Math.ceil(a.loaded/a.size*100):100,j()}function j(){var a,b;for(A.reset(),a=0;a0?Math.ceil(A.uploaded/D.length*100):0:(A.bytesPerSec=Math.ceil(A.loaded/((+new Date-z||1)/1e3)),A.percent=A.size>0?Math.ceil(A.loaded/A.size*100):0)}function k(){var a=F[0]||G[0];return!!a&&a.getRuntime().uid}function l(a,c){if(a.ruid){var d=b.Runtime.getInfo(a.ruid);if(d)return d.can(c)}return!1}function m(){this.bind("FilesAdded FilesRemoved",function(a){a.trigger("QueueChanged"),a.refresh()}),this.bind("CancelUpload",u),this.bind("BeforeUpload",q),this.bind("UploadFile",r),this.bind("UploadProgress",s),this.bind("StateChanged",t),this.bind("QueueChanged",j),this.bind("Error",w),this.bind("FileUploaded",v),this.bind("Destroy",x)}function n(a,c){var d=this,e=0,f=[],h={runtime_order:a.runtimes,required_caps:a.required_features,preferred_caps:E};g.each(a.runtimes.split(/\s*,\s*/),function(b){a[b]&&(h[b]=a[b])}),a.browse_button&&g.each(a.browse_button,function(c){f.push(function(f){var i=new b.FileInput(g.extend({},h,{accept:a.filters.mime_types,name:a.file_data_name,multiple:a.multi_selection,container:a.container,browse_button:c}));i.onready=function(){var a=b.Runtime.getInfo(this.ruid);b.extend(d.features,{chunks:a.can("slice_blob"),multipart:a.can("send_multipart"),multi_selection:a.can("select_multiple")}),e++,F.push(this),f()},i.onchange=function(){d.addFile(this.files)},i.bind("mouseenter mouseleave mousedown mouseup",function(d){H||(a.browse_button_hover&&("mouseenter"===d.type?b.addClass(c,a.browse_button_hover):"mouseleave"===d.type&&b.removeClass(c,a.browse_button_hover)),a.browse_button_active&&("mousedown"===d.type?b.addClass(c,a.browse_button_active):"mouseup"===d.type&&b.removeClass(c,a.browse_button_active)))}),i.bind("mousedown",function(){d.trigger("Browse")}),i.bind("error runtimeerror",function(){i=null,f()}),i.init()})}),a.drop_element&&g.each(a.drop_element,function(a){f.push(function(c){var f=new b.FileDrop(g.extend({},h,{drop_zone:a}));f.onready=function(){var a=b.Runtime.getInfo(this.ruid);b.extend(d.features,{chunks:a.can("slice_blob"),multipart:a.can("send_multipart"),dragdrop:a.can("drag_and_drop")}),e++,G.push(this),c()},f.ondrop=function(){d.addFile(this.files)},f.bind("error runtimeerror",function(){f=null,c()}),f.init()})}),b.inSeries(f,function(){"function"==typeof c&&c(e)})}function o(a,d,e){var f=new b.Image;try{f.onload=function(){return d.width>this.width&&d.height>this.height&&d.quality===c&&d.preserve_headers&&!d.crop?(this.destroy(),e(a)):void f.downsize(d.width,d.height,d.crop,d.preserve_headers)},f.onresize=function(){e(this.getAsBlob(a.type,d.quality)),this.destroy()},f.onerror=function(){e(a)},f.load(a)}catch(g){e(a)}}function p(a,c,e){function f(a,b,c){var d=y[a];switch(a){case"max_file_size":"max_file_size"===a&&(y.max_file_size=y.filters.max_file_size=b);break;case"chunk_size":(b=g.parseSize(b))&&(y[a]=b,y.send_file_name=!0);break;case"multipart":y[a]=b,b||(y.send_file_name=!0);break;case"unique_names":y[a]=b,b&&(y.send_file_name=!0);break;case"filters":"array"===g.typeOf(b)&&(b={mime_types:b}),c?g.extend(y.filters,b):y.filters=b,b.mime_types&&(y.filters.mime_types.regexp=function(a){var b=[];return g.each(a,function(a){g.each(a.extensions.split(/,/),function(a){/^\s*\*\s*$/.test(a)?b.push("\\.*"):b.push("\\."+a.replace(new RegExp("["+"/^$.*+?|()[]{}\\".replace(/./g,"\\$&")+"]","g"),"\\$&"))})}),new RegExp("("+b.join("|")+")$","i")}(y.filters.mime_types));break;case"resize":c?g.extend(y.resize,b,{enabled:!0}):y.resize=b;break;case"prevent_duplicates":y.prevent_duplicates=y.filters.prevent_duplicates=!!b;break;case"container":case"browse_button":case"drop_element":b="container"===a?g.get(b):g.getAll(b);case"runtimes":case"multi_selection":y[a]=b,c||(i=!0);break;default:y[a]=b}c||h.trigger("OptionChanged",a,b,d)}var h=this,i=!1;"object"==typeof a?g.each(a,function(a,b){f(b,a,e)}):f(a,c,e),e?(y.required_features=d(g.extend({},y)),E=d(g.extend({},y,{required_features:!0}))):i&&(h.trigger("Destroy"),n.call(h,y,function(a){a?(h.runtime=b.Runtime.getInfo(k()).type,h.trigger("Init",{runtime:h.runtime}),h.trigger("PostInit")):h.trigger("Error",{code:g.INIT_ERROR,message:g.translate("Init error.")})}))}function q(a,b){if(a.settings.unique_names){var c=b.name.match(/\.([^.]+)$/),d="part";c&&(d=c[1]),b.target_name=b.id+"."+d}}function r(a,c){function d(){k-- >0?e(f,1e3):(c.loaded=n,a.trigger("Error",{code:g.HTTP_ERROR,message:g.translate("HTTP Error."),file:c,response:B.responseText,status:B.status,responseHeaders:B.getAllResponseHeaders()}))}function f(){var l,o,p,q={};c.status===g.UPLOADING&&a.state!==g.STOPPED&&(a.settings.send_file_name&&(q.name=c.target_name||c.name),j&&m.chunks&&h.size>j?(p=Math.min(j,h.size-n),l=h.slice(n,n+p)):(p=h.size,l=h),j&&m.chunks&&(a.settings.send_chunk_number?(q.chunk=Math.ceil(n/j),q.chunks=Math.ceil(h.size/j)):(q.offset=n,q.total=h.size)),B=new b.XMLHttpRequest,B.upload&&(B.upload.onprogress=function(b){c.loaded=Math.min(c.size,n+b.loaded),a.trigger("UploadProgress",c)}),B.onload=function(){return B.status>=400?void d():(k=a.settings.max_retries,p=h.size?(c.size!=c.origSize&&(h.destroy(),h=null),a.trigger("UploadProgress",c),c.status=g.DONE,a.trigger("FileUploaded",c,{response:B.responseText,status:B.status,responseHeaders:B.getAllResponseHeaders()})):e(f,1)))},B.onerror=function(){d()},B.onloadend=function(){this.destroy(),B=null},a.settings.multipart&&m.multipart?(B.open("post",i,!0),g.each(a.settings.headers,function(a,b){B.setRequestHeader(b,a)}),o=new b.FormData,g.each(g.extend(q,a.settings.multipart_params),function(a,b){o.append(b,a)}),o.append(a.settings.file_data_name,l),B.send(o,{runtime_order:a.settings.runtimes,required_caps:a.settings.required_features,preferred_caps:E})):(i=g.buildUrl(a.settings.url,g.extend(q,a.settings.multipart_params)),B.open("post",i,!0),B.setRequestHeader("Content-Type","application/octet-stream"),g.each(a.settings.headers,function(a,b){B.setRequestHeader(b,a)}),B.send(l,{runtime_order:a.settings.runtimes,required_caps:a.settings.required_features,preferred_caps:E})))}var h,i=a.settings.url,j=a.settings.chunk_size,k=a.settings.max_retries,m=a.features,n=0;c.loaded&&(n=c.loaded=j?j*Math.floor(c.loaded/j):0),h=c.getSource(),a.settings.resize.enabled&&l(h,"send_binary_string")&&~b.inArray(h.type,["image/jpeg","image/png"])?o.call(this,h,a.settings.resize,function(a){h=a,c.size=a.size,f()}):f()}function s(a,b){i(b)}function t(a){if(a.state==g.STARTED)z=+new Date;else if(a.state==g.STOPPED)for(var b=a.files.length-1;b>=0;b--)a.files[b].status==g.UPLOADING&&(a.files[b].status=g.QUEUED,j())}function u(){B&&B.abort()}function v(a){j(),e(function(){h.call(a)},1)}function w(a,b){b.code===g.INIT_ERROR?a.destroy():b.code===g.HTTP_ERROR&&(b.file.status=g.FAILED,i(b.file),a.state==g.STARTED&&(a.trigger("CancelUpload"),e(function(){h.call(a)},1)))}function x(a){a.stop(),g.each(D,function(a){a.destroy()}),D=[],F.length&&(g.each(F,function(a){a.destroy()}),F=[]),G.length&&(g.each(G,function(a){a.destroy()}),G=[]),E={},H=!1,z=B=null,A.reset()}var y,z,A,B,C=g.guid(),D=[],E={},F=[],G=[],H=!1;y={runtimes:b.Runtime.order,max_retries:0,chunk_size:0,multipart:!0,multi_selection:!0,file_data_name:"file",filters:{mime_types:[],prevent_duplicates:!1,max_file_size:0},resize:{enabled:!1,preserve_headers:!0,crop:!1},send_file_name:!0,send_chunk_number:!0},p.call(this,a,null,!0),A=new g.QueueProgress,g.extend(this,{id:C,uid:C,state:g.STOPPED,features:{},runtime:null,files:D,settings:y,total:A,init:function(){var a,c,d=this;return a=d.getOption("preinit"),"function"==typeof a?a(d):g.each(a,function(a,b){d.bind(b,a)}),m.call(d),g.each(["container","browse_button","drop_element"],function(a){if(null===d.getOption(a))return c={code:g.INIT_ERROR,message:g.translate("'%' specified, but cannot be found.")},!1}),c?d.trigger("Error",c):y.browse_button||y.drop_element?void n.call(d,y,function(a){var c=d.getOption("init");"function"==typeof c?c(d):g.each(c,function(a,b){d.bind(b,a)}),a?(d.runtime=b.Runtime.getInfo(k()).type,d.trigger("Init",{runtime:d.runtime}),d.trigger("PostInit")):d.trigger("Error",{code:g.INIT_ERROR,message:g.translate("Init error.")})}):d.trigger("Error",{code:g.INIT_ERROR,message:g.translate("You must specify either 'browse_button' or 'drop_element'.")})},setOption:function(a,b){p.call(this,a,b,!this.runtime)},getOption:function(a){return a?y[a]:y},refresh:function(){F.length&&g.each(F,function(a){a.trigger("Refresh")}),this.trigger("Refresh")},start:function(){this.state!=g.STARTED&&(this.state=g.STARTED,this.trigger("StateChanged"),h.call(this))},stop:function(){this.state!=g.STOPPED&&(this.state=g.STOPPED,this.trigger("StateChanged"),this.trigger("CancelUpload"))},disableBrowse:function(){H=arguments[0]===c||arguments[0],F.length&&g.each(F,function(a){a.disable(H)}),this.trigger("DisableBrowse",H)},getFile:function(a){var b;for(b=D.length-1;b>=0;b--)if(D[b].id===a)return D[b]},addFile:function(a,c){function d(a,c){var d=[];b.each(j.settings.filters,function(b,c){f[c]&&d.push(function(d){f[c].call(j,b,a,function(a){d(!a)})})}),b.inSeries(d,c)}function h(a){var f=b.typeOf(a);if(a instanceof b.File){if(!a.ruid&&!a.isDetached()){if(!i)return!1;a.ruid=i,a.connectRuntime(i)}h(new g.File(a))}else a instanceof b.Blob?(h(a.getSource()),a.destroy()):a instanceof g.File?(c&&(a.name=c),l.push(function(b){d(a,function(c){c||(D.push(a),m.push(a),j.trigger("FileFiltered",a)),e(b,1)})})):b.inArray(f,["file","blob"])!==-1?h(new b.File(null,a)):"node"===f&&"filelist"===b.typeOf(a.files)?b.each(a.files,h):"array"===f&&(c=null,b.each(a,h))}var i,j=this,l=[],m=[];i=k(),h(a),l.length&&b.inSeries(l,function(){m.length&&j.trigger("FilesAdded",m)})},removeFile:function(a){for(var b="string"==typeof a?a:a.id,c=D.length-1;c>=0;c--)if(D[c].id===b)return this.splice(c,1)[0]},splice:function(a,b){var d=D.splice(a===c?0:a,b===c?D.length:b),e=!1;return this.state==g.STARTED&&(g.each(d,function(a){if(a.status===g.UPLOADING)return e=!0,!1}),e&&this.stop()),this.trigger("FilesRemoved",d),g.each(d,function(a){a.destroy()}),e&&this.start(),d},dispatchEvent:function(a){var b,c;if(a=a.toLowerCase(),b=this.hasEventListener(a)){b.sort(function(a,b){return b.priority-a.priority}),c=[].slice.call(arguments),c.shift(),c.unshift(this);for(var d=0;d