/*! * * PRC Parent Theme * * @author Seth Rubenstein * @version 0.1.0 * @link https://github.com/wpcomvip/pewresearch-org * @license GPL * * Copyright (c) 2023 Seth Rubenstein * * This software is released under the UNLICENSED License * https://opensource.org/licenses/UNLICENSED * * Compiled with the help of https://wpack.io * A zero setup Webpack Bundler Script for WordPress */!function(e){function r(r){for(var n,i,l=r[0],a=r[1],p=r[2],c=0,s=[];c=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(118),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(25))},118:function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,o,i,a,u,c=1,l={},s=!1,f=e.document,d=Object.getPrototypeOf&&Object.getPrototypeOf(e);d=d&&d.setTimeout?d:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick((function(){m(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(a="setImmediate$"+Math.random()+"$",u=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(a)&&m(+t.data.slice(a.length))},e.addEventListener?e.addEventListener("message",u,!1):e.attachEvent("onmessage",u),r=function(t){e.postMessage(a+t,"*")}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){m(e.data)},r=function(e){i.port2.postMessage(e)}):f&&"onreadystatechange"in f.createElement("script")?(o=f.documentElement,r=function(e){var t=f.createElement("script");t.onreadystatechange=function(){m(e),t.onreadystatechange=null,o.removeChild(t),t=null},o.appendChild(t)}):r=function(e){setTimeout(m,0,e)},d.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n{Array.from(e.getElementsByClassName("vimeo-core-video")).forEach((e,t)=>{const n=new r.a(e);n.on("play",()=>(e=>{o.videoPlayers.forEach((t,n)=>{var r;n!==e&&(r=t.element.src,"true"===new URL(r).searchParams.get("autopause"))&&t.pause()})})(t)),o.videoPlayers.push(n)})};try{"undefined"!=typeof wp&&void 0!==wp.data&&"function"==typeof wp.data.subscribe&&wp.data.subscribe(()=>{wp.data.select("core/editor").getBlocks().filter(e=>"vimeo/create"===e.name).length!==o.videoPlayers.length&&(o.videoPlayers.forEach(e=>e.off("play")),o.videoPlayers=[],i(document.getElementById("editor")))}),window.jQuery(()=>i())}catch(e){console.error(e)}},25:function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},330:function(e,t,n){"use strict";n.r(t);var r=n(47),o=(n(325),n(73));Object(o.b)(),window.jQuery((function(){document.querySelectorAll('[data-js="vimeo-wc-video"]').forEach((function(e){e.classList.add("vimeo-wc-video");const t=JSON.parse(e.dataset.atts),n=new r.a(e.id,t);n.ready().then(()=>{const t=e.querySelector("iframe");if(!t)return;t.classList.add("vimeo-core-video");const r=Number.parseInt(t.width),o=Number.parseInt(t.height);if(r&&o&&(t.style.aspectRatio=`${r}/${o}`),"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0){const r=function(){t.classList.add("playing")},o=function(){t.classList.add("paused"),t.classList.remove("playing")};n.on("play",r),n.on("pause",o),e.addEventListener("click",()=>{n.play()})}})}))}));function i(e=".vimeo-wc__big-video iframe"){document.querySelectorAll(e).forEach(e=>{const t=new r.a(e);null==t||t.pause()})}function a(){document.querySelectorAll(".woocommerce-product-gallery .woocommerce-product-gallery__image").forEach(e=>{!function(e,t=(()=>{}),n=(()=>{})){new window.MutationObserver((function(e){for(const r of e)"attributes"===r.type&&(n(),"class"===r.attributeName&&t())})).observe(e,{attributes:!0})}(e,()=>{e.classList.contains("flex-active-slide")&&i(".vimeo-wc-video iframe")})})}const u=["autopause","autoplay","background","byline","color","controls","dnt","loop","maxheight","maxwidth","muted","pip","playsinline","portrait","quality","responsive","speed","texttrack","title","transparent"];try{window.jQuery((function(e){var t;if(e(".woocommerce-product-gallery"))if(window.PhotoSwipeUI_Default){function n(e){var t;const n=null===(t=e.src)||void 0===t?void 0:t.match(/#vimeo-wc/),r=document.querySelector(`[data-js="${e.src}"] iframe`);if(n&&r){const t=r.cloneNode(!0);Object(o.a)()&&(t.height=t.width="100%"),t.height=t.width="100%",e.html=`\n\t\t\t
\n\t\t\t\t${t.outerHTML}\n\t\t\t
`,delete e.src}}e(".woocommerce-product-gallery").on("wc-product-gallery-before-init",(function(t,r){e(r).on("mousedown",".flex-control-nav img",e=>{e.target.classList.contains("flex-active")||i(".vimeo-wc-video iframe")});const o=window.PhotoSwipeUI_Default;window.PhotoSwipeUI_Default=function(e,t){return e.items.forEach(n),e.listen("close",()=>{i(".vimeo-wc__big-video iframe")}),e.listen("beforeChange",()=>{i(".vimeo-wc__big-video iframe")}),e.listen("initialZoomIn",()=>{i(".vimeo-wc-video iframe")}),new o(e,t)}})),a()}else null!==(t=window.avadaLightBox)&&void 0!==t&&t.refresh_lightbox?(document.querySelectorAll(".vimeo-wc__gallery-video").forEach(e=>{e.style.position="relative";const t=JSON.parse(e.querySelector('[data-js="vimeo-wc-video"]').dataset.atts),n=document.createElement("a");n.href=function(e,t){const n=new URL(e);for(const e of Object.keys(t).sort()){const r=t[e];u.includes(e)&&null!=r&&n.searchParams.set(e,r)}return n}(t.url,t),n.dataset.rel="iLightbox[product-gallery]",n.dataset.title="",n.dataset.caption="",n.style.padding="5px",n.style.width="auto",n.style.position="absolute",n.style.top="1rem",n.style.right="1rem",n.style.zIndex="99",n.style.left="unset",n.style.fontSize="26px",n.style.height="52px",n.innerText="πŸ”",n.classList.add("avada-product-gallery-lightbox-trigger"),n.title="Open Vimeo Video in Lightbox",e.append(n)}),a()):a()}))}catch(e){console.error(e)}n(173)},47:function(e,t,n){"use strict";(function(e,n){function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n0&&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(c(r))return"https://vimeo.com/".concat(r);if(l(r))return r.replace("http:","https:");if(t)throw new TypeError("β€œ".concat(t,"” is not a valid video id."));throw new TypeError("β€œ".concat(r,"” is not a vimeo.com url."))}var f=void 0!==Array.prototype.indexOf,d="undefined"!=typeof window&&void 0!==window.postMessage;if(!(i||f&&d))throw new Error("Sorry, the Vimeo Player API is not available in this browser.");var h="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==e?e:"undefined"!=typeof self?self:{};!function(e){if(!e.WeakMap){var t=Object.prototype.hasOwnProperty,n=function(e,t,n){Object.defineProperty?Object.defineProperty(e,t,{configurable:!0,writable:!0,value:n}):e[t]=n};e.WeakMap=function(){function e(){if(void 0===this)throw new TypeError("Constructor WeakMap requires 'new'");if(n(this,"_id",i("_WeakMap")),arguments.length>0)throw new TypeError("WeakMap iterable is not supported")}function o(e,n){if(!r(e)||!t.call(e,"_id"))throw new TypeError(n+" method called on incompatible receiver "+typeof e)}function i(e){return e+"_"+a()+"."+a()}function a(){return Math.random().toString().substring(2)}return n(e.prototype,"delete",(function(e){if(o(this,"delete"),!r(e))return!1;var t=e[this._id];return!(!t||t[0]!==e||(delete e[this._id],0))})),n(e.prototype,"get",(function(e){if(o(this,"get"),r(e)){var t=e[this._id];return t&&t[0]===e?t[1]:void 0}})),n(e.prototype,"has",(function(e){if(o(this,"has"),!r(e))return!1;var t=e[this._id];return!(!t||t[0]!==e)})),n(e.prototype,"set",(function(e,t){if(o(this,"set"),!r(e))throw new TypeError("Invalid value used as weak map key");var i=e[this._id];return i&&i[0]===e?(i[1]=t,this):(n(e,this._id,[e,t]),this)})),n(e,"_polyfill",!0),e}()}function r(e){return Object(e)===e}}("undefined"!=typeof self?self:"undefined"!=typeof window?window:h);var m=function(e,t){return function(e){var t,r;r=function(){var e,t,r,o=Object.prototype.toString,i=void 0!==n?function(e){return n(e)}:setTimeout;try{Object.defineProperty({},"x",{}),e=function(e,t,n,r){return Object.defineProperty(e,t,{value:n,writable:!0,configurable:!1!==r})}}catch(t){e=function(e,t,n){return e[t]=n,e}}function a(e,n){r.add(e,n),t||(t=i(r.drain))}function u(e){var t,n=typeof e;return null==e||"object"!=n&&"function"!=n||(t=e.then),"function"==typeof t&&t}function c(){for(var e=0;e0&&a(c,n))}catch(e){f.call(new h(n),e)}}}function f(e){var t=this;t.triggered||(t.triggered=!0,t.def&&(t=t.def),t.msg=e,t.state=2,t.chain.length>0&&a(c,t))}function d(e,t,n,r){for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:{};return b.reduce((function(t,n){var r=e.getAttribute("data-vimeo-".concat(n));return(r||""===r)&&(t[n]=""===r?1:r),t}),t)}function E(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 T(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0;return new Promise((function(r,o){if(!l(e))throw new TypeError("β€œ".concat(e,"” is not a vimeo.com url."));var i="https://vimeo.com/api/oembed.json?url=".concat(encodeURIComponent(e));for(var a in t)t.hasOwnProperty(a)&&(i+="&".concat(a,"=").concat(encodeURIComponent(t[a])));var u="XDomainRequest"in window?new XDomainRequest:new XMLHttpRequest;u.open("GET",i,!0),u.onload=function(){if(404!==u.status)if(403!==u.status)try{var t=JSON.parse(u.responseText);if(403===t.domain_status_code)return E(t,n),void o(new Error("β€œ".concat(e,"” is not embeddable.")));r(t)}catch(e){o(e)}else o(new Error("β€œ".concat(e,"” is not embeddable.")));else o(new Error("β€œ".concat(e,"” was not found.")))},u.onerror=function(){var e=u.status?" (".concat(u.status,")"):"";o(new Error("There was an error fetching the embed code from Vimeo".concat(e,".")))},u.send()}))}function _(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){return console.warn(e),{}}return 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 o=parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/,"$1"));o>=8&&o<10&&(r=JSON.stringify(r)),e.element.contentWindow.postMessage(r,e.origin)}}function x(e,t){var n,r=[];if((t=_(t)).event)"error"===t.event&&y(e,t.data.method).forEach((function(n){var r=new Error(t.data.message);r.name=t.data.name,n.reject(r),g(e,t.data.method,n)})),r=y(e,"event:".concat(t.event)),n=t.data;else if(t.method){var o=function(e,t){var n=y(e,t);if(n.length<1)return!1;var r=n.shift();return g(e,t,r),r}(e,t.method);o&&(r.push(o),n=t.value)}r.forEach((function(t){try{if("function"==typeof t)return void t.call(e,n);t.resolve(n)}catch(e){}}))}var M=new WeakMap,j=new WeakMap,I={},N=function(){function e(t){var n=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(r(this,e),window.jQuery&&t instanceof jQuery&&(t.length>1&&window.console&&console.warn&&console.warn("A jQuery object with multiple elements was passed, using the first element."),t=t[0]),"undefined"!=typeof document&&"string"==typeof t&&(t=document.getElementById(t)),!u(t))throw new TypeError("You must pass either a valid element or a valid id.");if("IFRAME"!==t.nodeName){var i=t.querySelector("iframe");i&&(t=i)}if("IFRAME"===t.nodeName&&!l(t.getAttribute("src")||""))throw new Error("The player element passed isn’t a Vimeo embed.");if(M.has(t))return M.get(t);this._window=t.ownerDocument.defaultView,this.element=t,this.origin="*";var a=new m((function(e,r){if(n._onMessage=function(t){if(l(t.origin)&&n.element.contentWindow===t.source){"*"===n.origin&&(n.origin=t.origin);var o=_(t.data);if(o&&"error"===o.event&&o.data&&"ready"===o.data.method){var i=new Error(o.data.message);return i.name=o.data.name,void r(i)}var a=o&&"ready"===o.event,u=o&&"ping"===o.method;if(a||u)return n.element.setAttribute("data-ready","true"),void e();x(n,o)}},n._window.addEventListener("message",n._onMessage),"IFRAME"!==n.element.nodeName){var i=k(t,o);T(s(i),i,t).then((function(e){var r=E(e,t);return n.element=r,n._originalElement=t,w(t,r),M.set(n.element,n),e})).catch(r)}}));if(j.set(this,a),M.set(this.element,this),"IFRAME"===this.element.nodeName&&P(this,"ping"),I.isEnabled){var c=function(){return I.exit()};I.on("fullscreenchange",(function(){I.isFullscreen?p(n,"event:exitFullscreen",c):g(n,"event:exitFullscreen",c),n.ready().then((function(){P(n,"fullscreenchange",I.isFullscreen)}))}))}return this}var t,n;return t=e,(n=[{key:"callMethod",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new m((function(r,o){return t.ready().then((function(){p(t,e,{resolve:r,reject:o}),P(t,e,n)})).catch(o)}))}},{key:"get",value:function(e){var t=this;return new m((function(n,r){return e=a(e,"get"),t.ready().then((function(){p(t,e,{resolve:n,reject:r}),P(t,e)})).catch(r)}))}},{key:"set",value:function(e,t){var n=this;return new m((function(r,o){if(e=a(e,"set"),null==t)throw new TypeError("There must be a value to set.");return n.ready().then((function(){p(n,e,{resolve:r,reject:o}),P(n,e,t)})).catch(o)}))}},{key:"on",value:function(e,t){if(!e)throw new TypeError("You must pass an event name.");if(!t)throw new TypeError("You must pass a callback function.");if("function"!=typeof t)throw new TypeError("The callback must be a function.");0===y(this,"event:".concat(e)).length&&this.callMethod("addEventListener",e).catch((function(){})),p(this,"event:".concat(e),t)}},{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.");g(this,"event:".concat(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=j.get(this)||new m((function(e,t){t(new Error("Unknown player. Probably unloaded."))}));return m.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:"requestFullscreen",value:function(){return I.isEnabled?I.request(this.element):this.callMethod("requestFullscreen")}},{key:"exitFullscreen",value:function(){return I.isEnabled?I.exit():this.callMethod("exitFullscreen")}},{key:"getFullscreen",value:function(){return I.isEnabled?m.resolve(I.isFullscreen):this.get("fullscreen")}},{key:"requestPictureInPicture",value:function(){return this.callMethod("requestPictureInPicture")}},{key:"exitPictureInPicture",value:function(){return this.callMethod("exitPictureInPicture")}},{key:"getPictureInPicture",value:function(){return this.get("pictureInPicture")}},{key:"unload",value:function(){return this.callMethod("unload")}},{key:"destroy",value:function(){var e=this;return new m((function(t){if(j.delete(e),M.delete(e.element),e._originalElement&&(M.delete(e._originalElement),e._originalElement.removeAttribute("data-vimeo-initialized")),e.element&&"IFRAME"===e.element.nodeName&&e.element.parentNode&&(e.element.parentNode.parentNode&&e._originalElement&&e._originalElement!==e.element.parentNode?e.element.parentNode.parentNode.removeChild(e.element.parentNode):e.element.parentNode.removeChild(e.element)),e.element&&"DIV"===e.element.nodeName&&e.element.parentNode){e.element.removeAttribute("data-vimeo-initialized");var n=e.element.querySelector("iframe");n&&n.parentNode&&(n.parentNode.parentNode&&e._originalElement&&e._originalElement!==n.parentNode?n.parentNode.parentNode.removeChild(n.parentNode):n.parentNode.removeChild(n))}e._window.removeEventListener("message",e._onMessage),t()}))}},{key:"getAutopause",value:function(){return this.get("autopause")}},{key:"setAutopause",value:function(e){return this.set("autopause",e)}},{key:"getBuffered",value:function(){return this.get("buffered")}},{key:"getCameraProps",value:function(){return this.get("cameraProps")}},{key:"setCameraProps",value:function(e){return this.set("cameraProps",e)}},{key:"getChapters",value:function(){return this.get("chapters")}},{key:"getCurrentChapter",value:function(){return this.get("currentChapter")}},{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:"setMuted",value:function(e){return this.set("muted",e)}},{key:"getMuted",value:function(){return this.get("muted")}},{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:"getPlayed",value:function(){return this.get("played")}},{key:"getQualities",value:function(){return this.get("qualities")}},{key:"getQuality",value:function(){return this.get("quality")}},{key:"setQuality",value:function(e){return this.set("quality",e)}},{key:"getSeekable",value:function(){return this.get("seekable")}},{key:"getSeeking",value:function(){return this.get("seeking")}},{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)}}])&&o(t.prototype,n),e}();i||(I=function(){var e=function(){for(var e,t=[["requestFullscreen","exitFullscreen","fullscreenElement","fullscreenEnabled","fullscreenchange","fullscreenerror"],["webkitRequestFullscreen","webkitExitFullscreen","webkitFullscreenElement","webkitFullscreenEnabled","webkitfullscreenchange","webkitfullscreenerror"],["webkitRequestFullScreen","webkitCancelFullScreen","webkitCurrentFullScreenElement","webkitCancelFullScreen","webkitfullscreenchange","webkitfullscreenerror"],["mozRequestFullScreen","mozCancelFullScreen","mozFullScreenElement","mozFullScreenEnabled","mozfullscreenchange","mozfullscreenerror"],["msRequestFullscreen","msExitFullscreen","msFullscreenElement","msFullscreenEnabled","MSFullscreenChange","MSFullscreenError"]],n=0,r=t.length,o={};n0&&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: ".concat(e))};t.forEach((function(e){try{if(null!==e.getAttribute("data-vimeo-defer"))return;var t=k(e);T(s(t),t,e).then((function(t){return E(t,e)})).catch(n)}catch(e){n(e)}}))}(),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document;if(!window.VimeoPlayerResizeEmbeds_){window.VimeoPlayerResizeEmbeds_=!0;var t=function(t){if(l(t.origin)&&t.data&&"spacechange"===t.data.event)for(var n=e.querySelectorAll("iframe"),r=0;r1)for(var n=1;n{document.querySelectorAll("iframe.vimeo-core-video").forEach(e=>{var t,n;const r=null!==(t=e.height)&&void 0!==t&&t.endsWith("%")?9:parseInt(e.height),o=null!==(n=e.width)&&void 0!==n&&n.endsWith("%")?16:parseInt(e.width),i=e.offsetWidth*r/o+"px";r&&o&&e.style.height!==i&&(e.style.height=i)})},1500)),r}}});; /*! * enquire.js v2.1.6 - Awesome Media Queries in JavaScript * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/enquire.js * License: MIT */ !function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.enquire=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g"})}(i,n):"Error",a=this.serviceName+": "+s+" ("+o+").",c=new f(o,a),p=0,l=Object.keys(n);ps[0]&&e[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function _(t,e){var n="function"==typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||0>6|192:(55296==(64512&i)&&r+1>18|240,e[n++]=i>>12&63|128):e[n++]=i>>12|224,e[n++]=i>>6&63|128),e[n++]=63&i|128)}return e}function a(t){try{return l.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}var h={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},C=function(t,e){if(!t)throw c(e)},c=function(t){return new Error("Firebase Database ("+h.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)},l={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray:function(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i>2,c=(3&o)<<4|a>>4,p=(15&a)<<2|l>>6,d=63&l;h||(d=64,s||(p=64)),r.push(n[u],n[c],n[p],n[d])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(s(t),e)},decodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){for(var e=[],n=0,r=0;n>10)),e[r++]=String.fromCharCode(56320+(1023&s))}else{o=t[n++];var a=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&a)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray:function(t,e){this.init_();for(var n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i>4;if(r.push(l),64!==a){var u=s<<4&240|a>>2;if(r.push(u),64!==h){var c=a<<6&192|h;r.push(c)}}}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var t=0;t=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};function n(t){return function t(e,n){if(!(n instanceof Object))return n;switch(n.constructor){case Date:var r=n;return new Date(r.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return n}for(var i in n)n.hasOwnProperty(i)&&(e[i]=t(e[i],n[i]));return e}(void 0,t)}var p=(i.prototype.wrapCallback=function(n){var r=this;return function(t,e){t?r.reject(t):r.resolve(e),"function"==typeof n&&(r.promise.catch(function(){}),1===n.length?n(t):n(t,e))}},i);function i(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(t,e){n.resolve=t,n.reject=e})}function d(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test("undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:"")}function y(){return!0===h.NODE_ADMIN}var v,g=(t(m,v=Error),m);function m(t,e){var n=v.call(this,e)||this;return n.code=t,n.name="FirebaseError",Object.setPrototypeOf(n,m.prototype),Error.captureStackTrace&&Error.captureStackTrace(n,E.prototype.create),n}var E=(w.prototype.create=function(t){for(var e=[],n=1;n"})}(o,r):"Error",a=this.serviceName+": "+s+" ("+i+").",h=new g(i,a),l=0,u=Object.keys(r);l>>31)}var o,s,a=this.chain_[0],h=this.chain_[1],l=this.chain_[2],u=this.chain_[3],c=this.chain_[4];for(r=0;r<80;r++)s=r<40?r<20?(o=u^h&(l^u),1518500249):(o=h^l^u,1859775393):r<60?(o=h&l|u&(h|l),2400959708):(o=h^l^u,3395469782),i=(a<<5|a>>>27)+o+c+s+n[r]&4294967295,c=u,u=l,l=4294967295&(h<<30|h>>>2),h=a,a=i;this.chain_[0]=this.chain_[0]+a&4294967295,this.chain_[1]=this.chain_[1]+h&4294967295,this.chain_[2]=this.chain_[2]+l&4294967295,this.chain_[3]=this.chain_[3]+u&4294967295,this.chain_[4]=this.chain_[4]+c&4294967295},x.prototype.update=function(t,e){if(null!=t){void 0===e&&(e=t.length);for(var n=e-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r>i&255,++r;return t},x);function x(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(var t=1;t 4. Need to update it?")}var i=t+" failed: ";return i+=r+" argument "}function A(t,e,n,r){if((!r||n)&&"function"!=typeof n)throw new Error(F(t,e,r)+"must be a valid function.")}function L(t,e,n,r){if((!r||n)&&("object"!=typeof n||null===n))throw new Error(F(t,e,r)+"must be a valid context object.")}function M(t){for(var e=0,n=0;n>6|192:(i<65536?e[n++]=i>>12|224:(e[n++]=i>>18|240,e[n++]=i>>12&63|128),e[n++]=i>>6&63|128),e[n++]=63&i|128)}return e}(t),n=new O;n.update(e);var r=n.digest();return l.encodeByteArray(r)}function X(t,e){C(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(lt.logLevel=W.VERBOSE,dt=lt.log.bind(lt),e&&ht.set("logging_enabled",!0)):"function"==typeof t?dt=t:(dt=null,ht.remove("logging_enabled"))}function $(){for(var t=[],e=0;e=Math.pow(2,-1022)?(n=(i=Math.min(Math.floor(Math.log(t)/Math.LN2),1023))+1023,Math.round(t*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,Math.round(t/Math.pow(2,-1074)))),s=[],o=52;o;o-=1)s.push(r%2?1:0),r=Math.floor(r/2);for(o=11;o;o-=1)s.push(n%2?1:0),n=Math.floor(n/2);s.push(e?1:0),s.reverse(),a=s.join("");var h="";for(o=0;o<64;o+=8){var l=parseInt(a.substr(o,8),2).toString(16);1===l.length&&(l="0"+l),h+=l}return h.toLowerCase()}function Et(t){try{t()}catch(e){setTimeout(function(){var t=e.stack||"";throw et("Exception was thrown by user callback.",t),e},Math.floor(0))}}function wt(t,e){var n=setTimeout(t,e);return"object"==typeof n&&n.unref&&n.unref(),n}var bt=new RegExp("^-?(0*)\\d{1,10}$"),St=function(t){if(bt.test(t)){var e=Number(t);if(-2147483648<=e&&e<=2147483647)return e}return null},Tt=(Object.defineProperty(It,"Empty",{get:function(){return new It("")},enumerable:!0,configurable:!0}),It.prototype.getFront=function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]},It.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},It.prototype.popFront=function(){var t=this.pieceNum_;return t=this.pieces_.length)return null;for(var t=[],e=this.pieceNum_;e=this.pieces_.length},It.relativePath=function(t,e){var n=t.getFront(),r=e.getFront();if(null===n)return e;if(n===r)return It.relativePath(t.popFront(),e.popFront());throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")},It.comparePaths=function(t,e){for(var n=t.slice(),r=e.slice(),i=0;it.getLength())return!1;for(;eRt.MAX_PATH_LENGTH_BYTES)throw new Error(this.errorPrefix_+"has a key path longer than "+Rt.MAX_PATH_LENGTH_BYTES+" bytes ("+this.byteLength_+").");if(this.parts_.length>Rt.MAX_PATH_DEPTH)throw new Error(this.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Rt.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},Rt.prototype.toErrorString=function(){return 0==this.parts_.length?"":"in property '"+this.parts_.join(".")+"'"},Rt);function Rt(t,e){this.errorPrefix_=e,this.parts_=t.slice(),this.byteLength_=Math.max(1,this.parts_.length);for(var n=0;n"),t},kt.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},kt);function kt(t,e,n,r,i,o){void 0===i&&(i=""),void 0===o&&(o=!1),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.persistenceKey=i,this.includeNamespaceInQueryParams=o,this.host=t.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=at.get("host:"+t)||this.host}function Ft(t){var e=Kt(t),n=e.namespace;"firebase"===e.domain&&tt(e.host+" is no longer supported. Please use .firebaseio.com instead"),n&&"undefined"!=n||"localhost"===e.domain||tt("Cannot parse Firebase url. Please use https://.firebaseio.com"),e.secure||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&et("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");var r="ws"===e.scheme||"wss"===e.scheme;return{repoInfo:new xt(e.host,e.secure,n,r,"",n!=e.subdomain),path:new Tt(e.pathString)}}function At(t){return"string"==typeof t&&0!==t.length&&!Yt.test(t)}function Lt(t){return"string"==typeof t&&0!==t.length&&!zt.test(t)}function Mt(t){return null===t||"string"==typeof t||"number"==typeof t&&!nt(t)||t&&"object"==typeof t&&N(t,".sv")}function Wt(t,e,n,r,i){i&&void 0===n||Xt(F(t,e,i),n,r)}function Qt(t,e,n,r,i){if(!i||void 0!==n){var o=F(t,e,i);if(!n||"object"!=typeof n||Array.isArray(n))throw new Error(o+" must be an object containing the children to replace.");var s=[];mt(n,function(t,e){var n=new Tt(t);if(Xt(o,e,r.child(n)),".priority"===n.getBack()&&!Mt(e))throw new Error(o+"contains an invalid value for '"+n.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");s.push(n)}),function(t,e){var n,r;for(n=0;nGt/3&&M(t)>Gt)throw new Error(n+"contains a string greater than "+Gt+" utf8 bytes "+r.toErrorString()+" ('"+t.substring(0,50)+"...')");if(t&&"object"==typeof t){var i=!1,o=!1;if(mt(t,function(t,e){if(".value"===t)i=!0;else if(".priority"!==t&&".sv"!==t&&(o=!0,!At(t)))throw new Error(n+" contains an invalid key ("+t+") "+r.toErrorString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');r.push(t),Xt(n,e,r),r.pop()}),i&&o)throw new Error(n+' contains ".value" child '+r.toErrorString()+" in addition to actual children.")}},$t=(Jt.prototype.cancel=function(t){k("OnDisconnect.cancel",0,1,arguments.length),A("OnDisconnect.cancel",1,t,!0);var e=new p;return this.repo_.onDisconnectCancel(this.path_,e.wrapCallback(t)),e.promise},Jt.prototype.remove=function(t){k("OnDisconnect.remove",0,1,arguments.length),Bt("OnDisconnect.remove",this.path_),A("OnDisconnect.remove",1,t,!0);var e=new p;return this.repo_.onDisconnectSet(this.path_,null,e.wrapCallback(t)),e.promise},Jt.prototype.set=function(t,e){k("OnDisconnect.set",1,2,arguments.length),Bt("OnDisconnect.set",this.path_),Wt("OnDisconnect.set",1,t,this.path_,!1),A("OnDisconnect.set",2,e,!0);var n=new p;return this.repo_.onDisconnectSet(this.path_,t,n.wrapCallback(e)),n.promise},Jt.prototype.setWithPriority=function(t,e,n){k("OnDisconnect.setWithPriority",2,3,arguments.length),Bt("OnDisconnect.setWithPriority",this.path_),Wt("OnDisconnect.setWithPriority",1,t,this.path_,!1),qt("OnDisconnect.setWithPriority",2,e,!1),A("OnDisconnect.setWithPriority",3,n,!0);var r=new p;return this.repo_.onDisconnectSetWithPriority(this.path_,t,e,r.wrapCallback(n)),r.promise},Jt.prototype.update=function(t,e){if(k("OnDisconnect.update",1,2,arguments.length),Bt("OnDisconnect.update",this.path_),Array.isArray(t)){for(var n={},r=0;rthis.lastWriteId_,"Stacking an older write on top of newer ones"),void 0===r&&(r=!0),this.allWrites_.push({path:t,snap:e,writeId:n,visible:r}),r&&(this.visibleWrites_=this.visibleWrites_.addWrite(t,e)),this.lastWriteId_=n},lr.prototype.addMerge=function(t,e,n){C(n>this.lastWriteId_,"Stacking an older merge on top of newer ones"),this.allWrites_.push({path:t,children:e,writeId:n,visible:!0}),this.visibleWrites_=this.visibleWrites_.addWrites(t,e),this.lastWriteId_=n},lr.prototype.getWrite=function(t){for(var e=0;edocument.domain="'+document.domain+'";<\/script>');var o=""+i+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(o),this.myIFrame.doc.close()}catch(t){$("frame writing exception"),t.stack&&$(t.stack),$(t)}}var Yr="";var zr=null;"undefined"!=typeof MozWebSocket?zr=MozWebSocket:"undefined"!=typeof WebSocket&&(zr=WebSocket);var Gr=(Xr.connectionURL_=function(t,e,n){var r={v:"5"};return"undefined"!=typeof location&&location.href&&-1!==location.href.indexOf(Pt)&&(r.r="f"),e&&(r.s=e),n&&(r.ls=n),t.connectionURL(Dt,r)},Xr.prototype.open=function(t,e){var n=this;this.onDisconnect=e,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,at.set("previous_websocket_failure",!0);try{if(y()){var r=h.NODE_ADMIN?"AdminNode":"Node",i={headers:{"User-Agent":"Firebase/5/"+Yr+"/"+process.platform+"/"+r}},o=process.env,s=0==this.connURL.indexOf("wss://")?o.HTTPS_PROXY||o.https_proxy:o.HTTP_PROXY||o.http_proxy;s&&(i.proxy={origin:s}),this.mySock=new zr(this.connURL,[],i)}else this.mySock=new zr(this.connURL)}catch(t){this.log_("Error instantiating WebSocket.");var a=t.message||t.data;return a&&this.log_(a),void this.onClosed_()}this.mySock.onopen=function(){n.log_("Websocket connected."),n.everConnected_=!0},this.mySock.onclose=function(){n.log_("Websocket connection was disconnected."),n.mySock=null,n.onClosed_()},this.mySock.onmessage=function(t){n.handleIncomingFrame(t)},this.mySock.onerror=function(t){n.log_("WebSocket error. Closing connection.");var e=t.message||t.data;e&&n.log_(e),n.onClosed_()}},Xr.prototype.start=function(){},Xr.forceDisallow=function(){Xr.forceDisallow_=!0},Xr.isAvailable=function(){var t=!1;if("undefined"!=typeof navigator&&navigator.userAgent){var e=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);e&&1=ui.MAX_TRANSACTION_RETRIES_)l=!0,u="maxretry",i=i.concat(this.serverSyncTree_.ackUserWrite(a.currentWriteId,!0));else{var c=this.getLatestState_(a.path,o);a.currentInputSnapshot=c;var p=t[s].update(c.val());if(void 0!==p){Xt("transaction failed: Data returned ",p,a.path);var d=$e(p);"object"==typeof p&&null!=p&&N(p,".priority")||(d=d.updatePriority(c.getPriority()));var f=a.currentWriteId,_=this.generateServerValues(),y=wn(d,_);a.currentOutputSnapshotRaw=d,a.currentOutputSnapshotResolved=y,a.currentWriteId=this.getNextWriteId_(),o.splice(o.indexOf(f),1),i=(i=i.concat(this.serverSyncTree_.applyUserOverwrite(a.path,y,a.currentWriteId,a.applyLocally))).concat(this.serverSyncTree_.ackUserWrite(f,!0))}else l=!0,u="nodata",i=i.concat(this.serverSyncTree_.ackUserWrite(a.currentWriteId,!0))}if(this.eventQueue_.raiseEventsForChangedPath(e,i),i=[],l&&(t[s].status=Ei.COMPLETED,n=t[s].unwatcher,setTimeout(n,Math.floor(0)),t[s].onComplete))if("nodata"===u){var v=new mi(this,t[s].path),g=t[s].currentInputSnapshot,m=new rn(g,v,Se);r.push(t[s].onComplete.bind(null,null,!1,m))}else r.push(t[s].onComplete.bind(null,new Error(u),!1,null))}this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_);for(s=0;s>>0),b=0;function y(t,e,n){return t.call.apply(t.bind,arguments)}function w(e,n,t){if(!e)throw Error();if(2"}else o=void 0===t?"undefined":null===t?"null":typeof t;O("Argument is not a %s (or a non-Element, non-Location mock); got: %s",e,o)}}R.prototype.add=function(t,e){var n=D.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},C.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null},C.prototype.reset=function(){this.next=this.b=this.a=null};var x=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if(h(t))return h(e)&&1==e.length?t.indexOf(e,0):-1;for(var n=0;n/g,lt=/"/g,ft=/'/g,dt=/\x00/g,pt=/[\x00&<>"']/;function vt(t,e){return-1!=t.indexOf(e)}function mt(t,e){return t");var Rt,Dt,Ct=Pt("");function Lt(t,e){for(var n=t.split("%s"),i="",r=Array.prototype.slice.call(arguments,1);r.length&&1")&&(t=t.replace(ht,">")),-1!=t.indexOf('"')&&(t=t.replace(lt,""")),-1!=t.indexOf("'")&&(t=t.replace(ft,"'")),-1!=t.indexOf("\0")&&(t=t.replace(dt,"�"))),t}function Mt(t){l.setTimeout(function(){throw t},0)}function jt(){var t=l.MessageChannel;if(void 0===t&&"undefined"!=typeof window&&window.postMessage&&window.addEventListener&&!St("Presto")&&(t=function(){var t=document.createElement("IFRAME");t.style.display="none",function(t){var e=at(z(Q));L(t,"HTMLIFrameElement"),t.src=et(e).toString()}(t),document.documentElement.appendChild(t);var e=t.contentWindow;(t=e.document).open(),t.write(Ot(Ct)),t.close();var n="callImmediate"+Math.random(),i="file:"==e.location.protocol?"*":e.location.protocol+"//"+e.location.host;t=I(function(t){"*"!=i&&t.origin!=i||t.data!=n||this.port1.onmessage()},this),e.addEventListener("message",t,!1),this.port1={},this.port2={postMessage:function(){e.postMessage(n,i)}}}),void 0===t||St("Trident")||St("MSIE"))return"undefined"!=typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(t){var e=document.createElement("SCRIPT");e.onreadystatechange=function(){e.onreadystatechange=null,e.parentNode.removeChild(e),e=null,t(),t=null},document.documentElement.appendChild(e)}:function(t){l.setTimeout(t,0)};var e=new t,n={},i=n;return e.port1.onmessage=function(){if(void 0!==n.next){var t=(n=n.next).yb;n.yb=null,t()}},function(t){i.next={yb:t},i=i.next,e.port2.postMessage(0)}}function Ut(t,e){Dt||function(){if(l.Promise&&l.Promise.resolve){var t=l.Promise.resolve(void 0);Dt=function(){t.then(Kt)}}else Dt=function(){var t=Kt;!m(l.setImmediate)||l.Window&&l.Window.prototype&&!St("Edge")&&l.Window.prototype.setImmediate==l.setImmediate?(Rt=Rt||jt())(t):l.setImmediate(t)}}(),Vt||(Dt(),Vt=!0),Ft.add(t,e)}Pt("
");var Vt=!1,Ft=new R;function Kt(){for(var t;n=e=void 0,n=null,(e=Ft).a&&(n=e.a,e.a=e.a.next,e.a||(e.b=null),n.next=null),t=n;){try{t.a.call(t.b)}catch(t){Mt(t)}P(D,t)}var e,n;Vt=!1}function qt(t,e){if(this.a=Ht,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,t!=d)try{var n=this;t.call(e,function(t){ee(n,Bt,t)},function(t){if(!(t instanceof ue))try{if(t instanceof Error)throw t;throw Error("Promise rejected.")}catch(t){}ee(n,Gt,t)})}catch(t){ee(this,Gt,t)}}var Ht=0,Bt=2,Gt=3;function Wt(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}Wt.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var Xt=new _(function(){return new Wt},function(t){t.reset()});function Jt(t,e,n){var i=Xt.get();return i.g=t,i.b=e,i.f=n,i}function Yt(t){if(t instanceof qt)return t;var e=new qt(d);return ee(e,Bt,t),e}function zt(n){return new qt(function(t,e){e(n)})}function $t(t,e,n){ne(t,e,n,null)||Ut(T(e,t))}function Zt(n){return new qt(function(i){var r=n.length,o=[];if(r)for(var t=function(t,e,n){r--,o[t]=e?{Gb:!0,value:n}:{Gb:!1,reason:n},0==r&&i(o)},e=0;eparseFloat(Te)){de=String(ke);break t}}de=Te}var Ae,Se={};function Ne(s){return function(t,e){var n=Se;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}(s,function(){for(var t=0,e=st(String(de)).split("."),n=st(String(s)).split("."),i=Math.max(e.length,n.length),r=0;0==t&&r>>0);function en(e){return m(e)?e:(e[tn]||(e[tn]=function(t){return e.handleEvent(t)}),e[tn])}function nn(){ce.call(this),this.u=new Ve(this),(this.Sb=this).Wa=null}function rn(t,e,n,i,r){t.u.add(String(e),n,!1,i,r)}function on(t,e,n,i,r){t.u.add(String(e),n,!0,i,r)}function an(t,e,n,i){if(!(e=t.u.a[String(e)]))return!0;e=e.concat();for(var r=!0,o=0;o>4&15).toString(16)+(15&t).toString(16)}vn.prototype.toString=function(){var t=[],e=this.f;e&&t.push(kn(e,Sn,!0),":");var n=this.b;return!n&&"file"!=e||(t.push("//"),(e=this.i)&&t.push(kn(e,Sn,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.l)&&t.push(":",String(n))),(n=this.c)&&(this.b&&"/"!=n.charAt(0)&&t.push("/"),t.push(kn(n,"/"==n.charAt(0)?On:Nn,!0))),(n=this.a.toString())&&t.push("?",n),(n=this.g)&&t.push("#",kn(n,Pn)),t.join("")},vn.prototype.resolve=function(t){var e=new vn(this),n=!!t.f;n?mn(e,t.f):n=!!t.i,n?e.i=t.i:n=!!t.b,n?e.b=t.b:n=null!=t.l;var i=t.c;if(n)gn(e,t.l);else if(n=!!t.c){if("/"!=i.charAt(0))if(this.b&&!this.c)i="/"+i;else{var r=e.c.lastIndexOf("/");-1!=r&&(i=e.c.substr(0,r+1)+i)}if(".."==(r=i)||"."==r)i="";else if(vt(r,"./")||vt(r,"/.")){i=0==r.lastIndexOf("/",0),r=r.split("/");for(var o=[],a=0;a2*t.c&&fn(t)))}function xn(t,e){return Dn(t),e=Un(t,e),dn(t.a.b,e)}function Mn(t,e,n){Ln(t,e),0"),o=o.join("")}return o=r.createElement(o),a&&(h(a)?o.className=a:p(a)?o.className=a.join(" "):Kn(o,a)),2'),a.document.write(Ot(t)),a.document.close())):(a=i.open(bt(e).toString(),n,a))&&t.noopener&&(a.opener=null),a)try{a.focus()}catch(t){}return a}var ni=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,ii=/^[^@]+@[^@]+$/;function ri(){var e=null;return new qt(function(t){"complete"==l.document.readyState?t():(e=function(){t()},We(window,"load",e))}).s(function(t){throw Xe(window,"load",e),t})}function oi(t){return t=t||vi(),!("file:"!==wi()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function ai(){var t=l.window;try{return!(!t||t==t.top)}catch(t){return!1}}function si(){return void 0!==l.WorkerGlobalScope&&"function"==typeof l.importScripts}function ui(){return fl.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":fl.INTERNAL.hasOwnProperty("node")?"Node":si()?"Worker":"Browser"}function ci(){var t=ui();return"ReactNative"===t||"Node"===t}var hi="Firefox",li="Chrome";function fi(t){var e=t.toLowerCase();return vt(e,"opera/")||vt(e,"opr/")||vt(e,"opios/")?"Opera":vt(e,"iemobile")?"IEMobile":vt(e,"msie")||vt(e,"trident/")?"IE":vt(e,"edge/")?"Edge":vt(e,"firefox/")?hi:vt(e,"silk/")?"Silk":vt(e,"blackberry")?"Blackberry":vt(e,"webos")?"Webos":!vt(e,"safari/")||vt(e,"chrome/")||vt(e,"crios/")||vt(e,"android")?!vt(e,"chrome/")&&!vt(e,"crios/")||vt(e,"edge/")?vt(e,"android")?"Android":(t=t.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==t.length?t[1]:"Other":li:"Safari"}var di={Vc:"FirebaseCore-web",Xc:"FirebaseUI-web"};function pi(t,e){e=e||[];var n,i=[],r={};for(n in di)r[di[n]]=!0;for(n=0;n>4),64!=a&&(t(o<<4&240|a>>2),64!=s&&t(a<<6&192|s))}}(t,function(t){e+=String.fromCharCode(t)}),e}function Tr(t){this.f=t.sub,this.a=t.provider_id||t.firebase&&t.firebase.sign_in_provider||null,this.c=t.firebase&&t.firebase.tenant||null,this.b=!!t.is_anonymous||"anonymous"==this.a}function Er(t){return(t=kr(t))&&t.sub&&t.iss&&t.aud&&t.exp?new Tr(t):null}function kr(t){if(!t)return null;if(3!=(t=t.split(".")).length)return null;for(var e=(4-(t=t[1]).length%4)%4,n=0;n Auth section -> Sign in method tab.",t):"http"==i||"https"==i?n=Lt("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",t):e="operation-not-supported-in-this-environment",Yi.call(this,e,n)}function So(t,e,n){Yi.call(this,t,n),(t=e||{}).Ab&&Mi(this,"email",t.Ab),t.ba&&Mi(this,"phoneNumber",t.ba),t.credential&&Mi(this,"credential",t.credential),t.Qb&&Mi(this,"tenantId",t.Qb)}function No(t){if(t.code){var e=t.code||"";0==e.indexOf($i)&&(e=e.substring($i.length));var n={credential:bo(t),Qb:t.tenantId};if(t.email)n.Ab=t.email;else if(t.phoneNumber)n.ba=t.phoneNumber;else if(!n.credential)return new Yi(e,t.message||void 0);return new So(e,n,t.message)}return null}function Oo(){}function _o(t){return t.c||(t.c=t.b())}function Po(){}function Ro(t){if(t.f||"undefined"!=typeof XMLHttpRequest||"undefined"==typeof ActiveXObject)return t.f;for(var e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],n=0;n=function t(e){return e.c?e.c:e.a?t(e.a):(O("Root logger has no level set."),null)}(this).value)for(m(e)&&(e=e()),t=new xo(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var qo,Ho={},Bo=null;function Go(t){var e;if(Bo||(Bo=new Mo(""),(Ho[""]=Bo).c=Fo),!(e=Ho[t])){e=new Mo(t);var n=t.lastIndexOf("."),i=t.substr(n+1);(n=Go(t.substr(0,n))).b||(n.b={}),(n.b[i]=e).a=n,Ho[t]=e}return e}function Wo(t,e){t&&t.log(Ko,e,void 0)}function Xo(t){this.f=t}function Jo(t){nn.call(this),this.o=t,this.readyState=Yo,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.i=new Headers,this.b=null,this.m="GET",this.g="",this.a=!1,this.h=Go("goog.net.FetchXmlHttp"),this.l=this.c=this.f=null}k(Xo,Oo),Xo.prototype.a=function(){return new Jo(this.f)},Xo.prototype.b=(qo={},function(){return qo}),k(Jo,nn);var Yo=0;function zo(t){t.c.read().then(t.ec.bind(t)).catch(t.Ma.bind(t))}function $o(t,e){e&&t.f&&(t.status=t.f.status,t.statusText=t.f.statusText),t.readyState=4,t.f=null,t.c=null,t.l=null,Zo(t)}function Zo(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function Qo(t){nn.call(this),this.headers=new ln,this.B=t||null,this.c=!1,this.w=this.a=null,this.h=this.O=this.l="",this.f=this.J=this.i=this.I=!1,this.g=0,this.o=null,this.m=ta,this.v=this.P=!1}(t=Jo.prototype).open=function(t,e){if(this.readyState!=Yo)throw this.abort(),Error("Error reopening a connection");this.m=t,this.g=e,this.readyState=1,Zo(this)},t.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.a=!0;var e={headers:this.i,method:this.m,credentials:void 0,cache:void 0};t&&(e.body=t),this.o.fetch(new Request(this.g,e)).then(this.jc.bind(this),this.Ma.bind(this))},t.abort=function(){this.response=this.responseText="",this.i=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&4!=this.readyState&&(this.a=!1,$o(this,!1)),this.readyState=Yo},t.jc=function(t){this.a&&(this.f=t,this.b||(this.b=t.headers,this.readyState=2,Zo(this)),this.a&&(this.readyState=3,Zo(this),this.a&&("arraybuffer"===this.responseType?t.arrayBuffer().then(this.hc.bind(this),this.Ma.bind(this)):void 0!==l.ReadableStream&&"body"in t?(this.response=this.responseText="",this.c=t.body.getReader(),this.l=new TextDecoder,zo(this)):t.text().then(this.ic.bind(this),this.Ma.bind(this)))))},t.ec=function(t){if(this.a){var e=this.l.decode(t.value?t.value:new Uint8Array(0),{stream:!t.done});e&&(this.response=this.responseText+=e),t.done?$o(this,!0):Zo(this),3==this.readyState&&zo(this)}},t.ic=function(t){this.a&&(this.response=this.responseText=t,$o(this,!0))},t.hc=function(t){this.a&&(this.response=t,$o(this,!0))},t.Ma=function(t){var e=this.h;e&&e.log(Vo,"Failed to fetch url "+this.g,t instanceof Error?t:Error(t)),this.a&&$o(this,!0)},t.setRequestHeader=function(t,e){this.i.append(t,e)},t.getResponseHeader=function(t){return this.b?this.b.get(t.toLowerCase())||"":((t=this.h)&&t.log(Vo,"Attempting to get response header but no headers have been received for url: "+this.g,void 0),"")},t.getAllResponseHeaders=function(){if(!this.b){var t=this.h;return t&&t.log(Vo,"Attempting to get all response headers but no headers have been received for url: "+this.g,void 0),""}t=[];for(var e=this.b.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},k(Qo,nn);var ta="";Qo.prototype.b=Go("goog.net.XhrIo");var ea=/^https?$/i,na=["POST","PUT"];function ia(e,t,n,i,r){if(e.a)throw Error("[goog.net.XhrIo] Object is active with another request="+e.l+"; newUri="+t);n=n?n.toUpperCase():"GET",e.l=t,e.h="",e.O=n,e.I=!1,e.c=!0,e.a=e.B?e.B.a():Eo.a(),e.w=e.B?_o(e.B):_o(Eo),e.a.onreadystatechange=I(e.Lb,e);try{Wo(e.b,fa(e,"Opening Xhr")),e.J=!0,e.a.open(n,String(t),!0),e.J=!1}catch(t){return Wo(e.b,fa(e,"Error opening Xhr: "+t.message)),void oa(e,t)}t=i||"";var o=new ln(e.headers);r&&function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(v(t)||h(t))M(t,e,void 0);else for(var n=hn(t),i=cn(t),r=i.length,o=0;o>>7|r<<25)^(r>>>18|r<<14)^r>>>3)|0,a=(0|n[e-7])+((i>>>17|i<<15)^(i>>>19|i<<13)^i>>>10)|0;n[e]=o+a|0}i=0|t.a[0],r=0|t.a[1];var s=0|t.a[2],u=0|t.a[3],c=0|t.a[4],h=0|t.a[5],l=0|t.a[6];for(o=0|t.a[7],e=0;e<64;e++){var f=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&r^i&s^r&s)|0;a=(o=o+((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))|0)+((a=(a=c&h^~c&l)+(0|Pu[e])|0)+(0|n[e])|0)|0,o=l,l=h,h=c,c=u+a|0,u=s,s=r,r=i,i=a+f|0}t.a[0]=t.a[0]+i|0,t.a[1]=t.a[1]+r|0,t.a[2]=t.a[2]+s|0,t.a[3]=t.a[3]+u|0,t.a[4]=t.a[4]+c|0,t.a[5]=t.a[5]+h|0,t.a[6]=t.a[6]+l|0,t.a[7]=t.a[7]+o|0}function Fu(t,e,n){void 0===n&&(n=e.length);var i=0,r=t.c;if(h(e))for(;i>r&255;return function(t){return j(t,function(t){return 1<(t=t.toString(16)).length?t:"0"+t}).join("")}(t)}function Xu(t,e){for(var n=0;nt.f&&(t.a=t.f),e)}function Ac(t){this.f=t,this.b=this.a=null,this.c=0}function Sc(t,e){var n=e[Da],i=e.refreshToken;e=Nc(e.expiresIn),t.b=n,t.c=e,t.a=i}function Nc(t){return E()+1e3*parseInt(t,10)}function Oc(e,t){return function(t,i){return new qt(function(e,n){"refresh_token"==i.grant_type&&i.refresh_token||"authorization_code"==i.grant_type&&i.code?Va(t,t.l+"?key="+encodeURIComponent(t.c),function(t){t?t.error?n(_s(t)):t.access_token&&t.refresh_token?e(t):n(new Yi("internal-error")):n(new Yi("network-request-failed"))},"POST",Cn(i).toString(),t.g,t.u.get()):n(new Yi("internal-error"))})}(e.f,t).then(function(t){return e.b=t.access_token,e.c=Nc(t.expires_in),e.a=t.refresh_token,{accessToken:e.b,expirationTime:e.c,refreshToken:e.a}}).s(function(t){throw"auth/user-token-expired"==t.code&&(e.a=null),t})}function _c(t,e){this.a=t||null,this.b=e||null,ji(this,{lastSignInTime:Pi(e||null),creationTime:Pi(t||null)})}function Pc(t,e,n,i,r,o){ji(this,{uid:t,displayName:i||null,photoURL:r||null,email:n||null,phoneNumber:o||null,providerId:e})}function Rc(t,e){for(var n in De.call(this,t),e)this[n]=e[n]}function Dc(t,e,n){this.I=[],this.l=t.apiKey,this.m=t.appName,this.o=t.authDomain||null,t=fl.SDK_VERSION?pi(fl.SDK_VERSION):null,this.a=new Pa(this.l,Nr(Ar),t),this.b=new Ac(this.a),Vc(this,e[Da]),Sc(this.b,e),Mi(this,"refreshToken",this.b.a),qc(this,n||{}),nn.call(this),this.J=!1,this.o&&bi()&&(this.i=fc(this.o,this.l,this.m)),this.O=[],this.h=null,this.w=function(e){return new Ec(function(){return e.G(!0)},function(t){return!(!t||"auth/network-request-failed"!=t.code)},function(){var t=e.b.c-E()-3e5;return 0this.c-3e4?this.a?Oc(this,{grant_type:"refresh_token",refresh_token:this.a}):Yt(null):Yt({accessToken:this.b,expirationTime:this.c,refreshToken:this.a})},_c.prototype.A=function(){return{lastLoginAt:this.b,createdAt:this.a}},k(Rc,De),k(Dc,nn),Dc.prototype.sa=function(t){this.ga=t,ja(this.a,t)},Dc.prototype.ha=function(){return this.ga},Dc.prototype.Aa=function(){return H(this.P)},Dc.prototype.Ha=function(){this.w.b&&(this.w.stop(),this.w.start())},Mi(Dc.prototype,"providerId","firebase"),(t=Dc.prototype).reload=function(){var t=this;return rh(this,Bc(this).then(function(){return zc(t).then(function(){return Fc(t)}).then(Hc)}))},t.dc=function(t){return this.G(t).then(function(t){return new Tc(t)})},t.G=function(t){var e=this;return rh(this,Bc(this).then(function(){return e.b.getToken(t)}).then(function(t){if(!t)throw new Yi("internal-error");return t.accessToken!=e.ma&&(Vc(e,t.accessToken),e.dispatchEvent(new Rc("tokenChanged"))),Jc(e,"refreshToken",t.refreshToken),t.accessToken}))},t.zc=function(t){if(!(t=t.users)||!t.length)throw new Yi("internal-error");qc(this,{uid:(t=t[0]).localId,displayName:t.displayName,photoURL:t.photoUrl,email:t.email,emailVerified:!!t.emailVerified,phoneNumber:t.phoneNumber,lastLoginAt:t.lastLoginAt,createdAt:t.createdAt,tenantId:t.tenantId});for(var e=function(t){return(t=t.providerUserInfo)&&t.length?j(t,function(t){return new Pc(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)}):[]}(t),n=0;n=Qh.length)throw new Yi("internal-error","Argument validator received an unsupported number of arguments.");n=Qh[r],i=(i?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.M+".";break t}i=null}}if(i)throw new Yi("argument-error",t+" failed: "+i)}(t=Hh.prototype).Ba=function(){var e=this;return this.f?this.f:this.f=Yh(this,Yt().then(function(){if(yi()&&!si())return ri();throw new Yi("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")}).then(function(){return e.m.g(e.v())}).then(function(t){return e.g=t,Ns(e.o,ds,{})}).then(function(t){e.a[Wh]=t.recaptchaSiteKey}).s(function(t){throw e.f=null,t}))},t.render=function(){zh(this);var n=this;return Yh(this,this.Ba().then(function(){if(null===n.c){var t=n.u;if(!n.i){var e=Fn(t);t=Hn("DIV"),e.appendChild(t)}n.c=n.g.render(t,n.a)}return n.c}))},t.verify=function(){zh(this);var r=this;return Yh(this,this.render().then(function(i){return new qt(function(e){var t=r.g.getResponse(i);if(t)e(t);else{var n=function(t){t&&(function(t,e){K(t.l,function(t){return t==e})}(r,n),e(t))};r.l.push(n),r.i&&r.g.execute(r.c)}})}))},t.reset=function(){zh(this),null!==this.c&&this.g.reset(this.c)},t.clear=function(){zh(this),this.B=!0,this.m.c();for(var t=0;t { const editLinks = document.querySelectorAll('.prc-block-area__edit-link'); editLinks.forEach((editLink) => { const a = editLink.querySelector('a'); a.addEventListener('mouseover', () => { const area = editLink.closest('.prc-block-area'); area.classList.add('editor-link-is-hovering'); }); a.addEventListener('mouseout', () => { const area = editLink.closest('.prc-block-area'); area.classList.remove('editor-link-is-hovering'); }); }); }, false, ); ; /*! * # Semantic UI - Accordion * http://github.com/semantic-org/semantic-ui/ * * * Released under the MIT license * http://opensource.org/licenses/MIT * */ ;(function ($, window, document, undefined) { 'use strict'; window = (typeof window != 'undefined' && window.Math == Math) ? window : (typeof self != 'undefined' && self.Math == Math) ? self : Function('return this')() ; $.fn.accordion = function(parameters) { var $allModules = $(this), time = new Date().getTime(), performance = [], query = arguments[0], methodInvoked = (typeof query == 'string'), queryArguments = [].slice.call(arguments, 1), requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || function(callback) { setTimeout(callback, 0); }, returnedValue ; $allModules .each(function() { var settings = ( $.isPlainObject(parameters) ) ? $.extend(true, {}, $.fn.accordion.settings, parameters) : $.extend({}, $.fn.accordion.settings), className = settings.className, namespace = settings.namespace, selector = settings.selector, error = settings.error, eventNamespace = '.' + namespace, moduleNamespace = 'module-' + namespace, moduleSelector = $allModules.selector || '', $module = $(this), $title = $module.find(selector.title), $content = $module.find(selector.content), element = this, instance = $module.data(moduleNamespace), observer, module ; module = { initialize: function() { module.debug('Initializing', $module); module.bind.events(); if(settings.observeChanges) { module.observeChanges(); } module.instantiate(); }, instantiate: function() { instance = module; $module .data(moduleNamespace, module) ; }, destroy: function() { module.debug('Destroying previous instance', $module); $module .off(eventNamespace) .removeData(moduleNamespace) ; }, refresh: function() { $title = $module.find(selector.title); $content = $module.find(selector.content); }, observeChanges: function() { if('MutationObserver' in window) { observer = new MutationObserver(function(mutations) { module.debug('DOM tree modified, updating selector cache'); module.refresh(); }); observer.observe(element, { childList : true, subtree : true }); module.debug('Setting up mutation observer', observer); } }, bind: { events: function() { module.debug('Binding delegated events'); $module .on(settings.on + eventNamespace, selector.trigger, module.event.click) ; } }, event: { click: function() { module.toggle.call(this); } }, toggle: function(query) { var $activeTitle = (query !== undefined) ? (typeof query === 'number') ? $title.eq(query) : $(query).closest(selector.title) : $(this).closest(selector.title), $activeContent = $activeTitle.next($content), isAnimating = $activeContent.hasClass(className.animating), isActive = $activeContent.hasClass(className.active), isOpen = (isActive && !isAnimating), isOpening = (!isActive && isAnimating) ; module.debug('Toggling visibility of content', $activeTitle); if(isOpen || isOpening) { if(settings.collapsible) { module.close.call($activeTitle); } else { module.debug('Cannot close accordion content collapsing is disabled'); } } else { module.open.call($activeTitle); } }, open: function(query) { var $activeTitle = (query !== undefined) ? (typeof query === 'number') ? $title.eq(query) : $(query).closest(selector.title) : $(this).closest(selector.title), $activeContent = $activeTitle.next($content), isAnimating = $activeContent.hasClass(className.animating), isActive = $activeContent.hasClass(className.active), isOpen = (isActive || isAnimating) ; if(isOpen) { module.debug('Accordion already open, skipping', $activeContent); return; } module.debug('Opening accordion content', $activeTitle); settings.onOpening.call($activeContent); settings.onChanging.call($activeContent); if(settings.exclusive) { module.closeOthers.call($activeTitle); } $activeTitle .addClass(className.active) ; $activeContent .stop(true, true) .addClass(className.animating) ; if(settings.animateChildren) { if($.fn.transition !== undefined && $module.transition('is supported')) { $activeContent .children() .transition({ animation : 'fade in', queue : false, useFailSafe : true, debug : settings.debug, verbose : settings.verbose, duration : settings.duration }) ; } else { $activeContent .children() .stop(true, true) .animate({ opacity: 1 }, settings.duration, module.resetOpacity) ; } } $activeContent .slideDown(settings.duration, settings.easing, function() { $activeContent .removeClass(className.animating) .addClass(className.active) ; module.reset.display.call(this); settings.onOpen.call(this); settings.onChange.call(this); }) ; }, close: function(query) { var $activeTitle = (query !== undefined) ? (typeof query === 'number') ? $title.eq(query) : $(query).closest(selector.title) : $(this).closest(selector.title), $activeContent = $activeTitle.next($content), isAnimating = $activeContent.hasClass(className.animating), isActive = $activeContent.hasClass(className.active), isOpening = (!isActive && isAnimating), isClosing = (isActive && isAnimating) ; if((isActive || isOpening) && !isClosing) { module.debug('Closing accordion content', $activeContent); settings.onClosing.call($activeContent); settings.onChanging.call($activeContent); $activeTitle .removeClass(className.active) ; $activeContent .stop(true, true) .addClass(className.animating) ; if(settings.animateChildren) { if($.fn.transition !== undefined && $module.transition('is supported')) { $activeContent .children() .transition({ animation : 'fade out', queue : false, useFailSafe : true, debug : settings.debug, verbose : settings.verbose, duration : settings.duration }) ; } else { $activeContent .children() .stop(true, true) .animate({ opacity: 0 }, settings.duration, module.resetOpacity) ; } } $activeContent .slideUp(settings.duration, settings.easing, function() { $activeContent .removeClass(className.animating) .removeClass(className.active) ; module.reset.display.call(this); settings.onClose.call(this); settings.onChange.call(this); }) ; } }, closeOthers: function(index) { var $activeTitle = (index !== undefined) ? $title.eq(index) : $(this).closest(selector.title), $parentTitles = $activeTitle.parents(selector.content).prev(selector.title), $activeAccordion = $activeTitle.closest(selector.accordion), activeSelector = selector.title + '.' + className.active + ':visible', activeContent = selector.content + '.' + className.active + ':visible', $openTitles, $nestedTitles, $openContents ; if(settings.closeNested) { $openTitles = $activeAccordion.find(activeSelector).not($parentTitles); $openContents = $openTitles.next($content); } else { $openTitles = $activeAccordion.find(activeSelector).not($parentTitles); $nestedTitles = $activeAccordion.find(activeContent).find(activeSelector).not($parentTitles); $openTitles = $openTitles.not($nestedTitles); $openContents = $openTitles.next($content); } if( ($openTitles.length > 0) ) { module.debug('Exclusive enabled, closing other content', $openTitles); $openTitles .removeClass(className.active) ; $openContents .removeClass(className.animating) .stop(true, true) ; if(settings.animateChildren) { if($.fn.transition !== undefined && $module.transition('is supported')) { $openContents .children() .transition({ animation : 'fade out', useFailSafe : true, debug : settings.debug, verbose : settings.verbose, duration : settings.duration }) ; } else { $openContents .children() .stop(true, true) .animate({ opacity: 0 }, settings.duration, module.resetOpacity) ; } } $openContents .slideUp(settings.duration , settings.easing, function() { $(this).removeClass(className.active); module.reset.display.call(this); }) ; } }, reset: { display: function() { module.verbose('Removing inline display from element', this); $(this).css('display', ''); if( $(this).attr('style') === '') { $(this) .attr('style', '') .removeAttr('style') ; } }, opacity: function() { module.verbose('Removing inline opacity from element', this); $(this).css('opacity', ''); if( $(this).attr('style') === '') { $(this) .attr('style', '') .removeAttr('style') ; } }, }, setting: function(name, value) { module.debug('Changing setting', name, value); if( $.isPlainObject(name) ) { $.extend(true, settings, name); } else if(value !== undefined) { if($.isPlainObject(settings[name])) { $.extend(true, settings[name], value); } else { settings[name] = value; } } else { return settings[name]; } }, internal: function(name, value) { module.debug('Changing internal', name, value); if(value !== undefined) { if( $.isPlainObject(name) ) { $.extend(true, module, name); } else { module[name] = value; } } else { return module[name]; } }, debug: function() { if(!settings.silent && settings.debug) { if(settings.performance) { module.performance.log(arguments); } else { module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':'); module.debug.apply(console, arguments); } } }, verbose: function() { if(!settings.silent && settings.verbose && settings.debug) { if(settings.performance) { module.performance.log(arguments); } else { module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':'); module.verbose.apply(console, arguments); } } }, error: function() { if(!settings.silent) { module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); module.error.apply(console, arguments); } }, performance: { log: function(message) { var currentTime, executionTime, previousTime ; if(settings.performance) { currentTime = new Date().getTime(); previousTime = time || currentTime; executionTime = currentTime - previousTime; time = currentTime; performance.push({ 'Name' : message[0], 'Arguments' : [].slice.call(message, 1) || '', 'Element' : element, 'Execution Time' : executionTime }); } clearTimeout(module.performance.timer); module.performance.timer = setTimeout(module.performance.display, 500); }, display: function() { var title = settings.name + ':', totalTime = 0 ; time = false; clearTimeout(module.performance.timer); $.each(performance, function(index, data) { totalTime += data['Execution Time']; }); title += ' ' + totalTime + 'ms'; if(moduleSelector) { title += ' \'' + moduleSelector + '\''; } if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) { console.groupCollapsed(title); if(console.table) { console.table(performance); } else { $.each(performance, function(index, data) { console.log(data['Name'] + ': ' + data['Execution Time']+'ms'); }); } console.groupEnd(); } performance = []; } }, invoke: function(query, passedArguments, context) { var object = instance, maxDepth, found, response ; passedArguments = passedArguments || queryArguments; context = element || context; if(typeof query == 'string' && object !== undefined) { query = query.split(/[\. ]/); maxDepth = query.length - 1; $.each(query, function(depth, value) { var camelCaseValue = (depth != maxDepth) ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1) : query ; if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) { object = object[camelCaseValue]; } else if( object[camelCaseValue] !== undefined ) { found = object[camelCaseValue]; return false; } else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) { object = object[value]; } else if( object[value] !== undefined ) { found = object[value]; return false; } else { module.error(error.method, query); return false; } }); } if ( $.isFunction( found ) ) { response = found.apply(context, passedArguments); } else if(found !== undefined) { response = found; } if($.isArray(returnedValue)) { returnedValue.push(response); } else if(returnedValue !== undefined) { returnedValue = [returnedValue, response]; } else if(response !== undefined) { returnedValue = response; } return found; } }; if(methodInvoked) { if(instance === undefined) { module.initialize(); } module.invoke(query); } else { if(instance !== undefined) { instance.invoke('destroy'); } module.initialize(); } }) ; return (returnedValue !== undefined) ? returnedValue : this ; }; $.fn.accordion.settings = { name : 'Accordion', namespace : 'accordion', silent : false, debug : false, verbose : false, performance : true, on : 'click', // event on title that opens accordion observeChanges : true, // whether accordion should automatically refresh on DOM insertion exclusive : true, // whether a single accordion content panel should be open at once collapsible : true, // whether accordion content can be closed closeNested : false, // whether nested content should be closed when a panel is closed animateChildren : true, // whether children opacity should be animated duration : 350, // duration of animation easing : 'easeOutQuad', // easing equation for animation onOpening : function(){}, // callback before open animation onClosing : function(){}, // callback before closing animation onChanging : function(){}, // callback before closing or opening animation onOpen : function(){}, // callback after open animation onClose : function(){}, // callback after closing animation onChange : function(){}, // callback after closing or opening animation error: { method : 'The method you called is not defined' }, className : { active : 'active', animating : 'animating' }, selector : { accordion : '.accordion', title : '.title', trigger : '.title', content : '.content' } }; // Adds easing $.extend( $.easing, { easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; } }); })( jQuery, window, document ); /*! * # Semantic UI - API * http://github.com/semantic-org/semantic-ui/ * * * Released under the MIT license * http://opensource.org/licenses/MIT * */ ;(function ($, window, document, undefined) { 'use strict'; var window = (typeof window != 'undefined' && window.Math == Math) ? window : (typeof self != 'undefined' && self.Math == Math) ? self : Function('return this')() ; $.api = $.fn.api = function(parameters) { var // use window context if none specified $allModules = $.isFunction(this) ? $(window) : $(this), moduleSelector = $allModules.selector || '', time = new Date().getTime(), performance = [], query = arguments[0], methodInvoked = (typeof query == 'string'), queryArguments = [].slice.call(arguments, 1), returnedValue ; $allModules .each(function() { var settings = ( $.isPlainObject(parameters) ) ? $.extend(true, {}, $.fn.api.settings, parameters) : $.extend({}, $.fn.api.settings), // internal aliases namespace = settings.namespace, metadata = settings.metadata, selector = settings.selector, error = settings.error, className = settings.className, // define namespaces for modules eventNamespace = '.' + namespace, moduleNamespace = 'module-' + namespace, // element that creates request $module = $(this), $form = $module.closest(selector.form), // context used for state $context = (settings.stateContext) ? $(settings.stateContext) : $module, // request details ajaxSettings, requestSettings, url, data, requestStartTime, // standard module element = this, context = $context[0], instance = $module.data(moduleNamespace), module ; module = { initialize: function() { if(!methodInvoked) { module.bind.events(); } module.instantiate(); }, instantiate: function() { module.verbose('Storing instance of module', module); instance = module; $module .data(moduleNamespace, instance) ; }, destroy: function() { module.verbose('Destroying previous module for', element); $module .removeData(moduleNamespace) .off(eventNamespace) ; }, bind: { events: function() { var triggerEvent = module.get.event() ; if( triggerEvent ) { module.verbose('Attaching API events to element', triggerEvent); $module .on(triggerEvent + eventNamespace, module.event.trigger) ; } else if(settings.on == 'now') { module.debug('Querying API endpoint immediately'); module.query(); } } }, decode: { json: function(response) { if(response !== undefined && typeof response == 'string') { try { response = JSON.parse(response); } catch(e) { // isnt json string } } return response; } }, read: { cachedResponse: function(url) { var response ; if(window.Storage === undefined) { module.error(error.noStorage); return; } response = sessionStorage.getItem(url); module.debug('Using cached response', url, response); response = module.decode.json(response); return response; } }, write: { cachedResponse: function(url, response) { if(response && response === '') { module.debug('Response empty, not caching', response); return; } if(window.Storage === undefined) { module.error(error.noStorage); return; } if( $.isPlainObject(response) ) { response = JSON.stringify(response); } sessionStorage.setItem(url, response); module.verbose('Storing cached response for url', url, response); } }, query: function() { if(module.is.disabled()) { module.debug('Element is disabled API request aborted'); return; } if(module.is.loading()) { if(settings.interruptRequests) { module.debug('Interrupting previous request'); module.abort(); } else { module.debug('Cancelling request, previous request is still pending'); return; } } // pass element metadata to url (value, text) if(settings.defaultData) { $.extend(true, settings.urlData, module.get.defaultData()); } // Add form content if(settings.serializeForm) { settings.data = module.add.formData(settings.data); } // call beforesend and get any settings changes requestSettings = module.get.settings(); // check if before send cancelled request if(requestSettings === false) { module.cancelled = true; module.error(error.beforeSend); return; } else { module.cancelled = false; } // get url url = module.get.templatedURL(); if(!url && !module.is.mocked()) { module.error(error.missingURL); return; } // replace variables url = module.add.urlData( url ); // missing url parameters if( !url && !module.is.mocked()) { return; } requestSettings.url = settings.base + url; // look for jQuery ajax parameters in settings ajaxSettings = $.extend(true, {}, settings, { type : settings.method || settings.type, data : data, url : settings.base + url, beforeSend : settings.beforeXHR, success : function() {}, failure : function() {}, complete : function() {} }); module.debug('Querying URL', ajaxSettings.url); module.verbose('Using AJAX settings', ajaxSettings); if(settings.cache === 'local' && module.read.cachedResponse(url)) { module.debug('Response returned from local cache'); module.request = module.create.request(); module.request.resolveWith(context, [ module.read.cachedResponse(url) ]); return; } if( !settings.throttle ) { module.debug('Sending request', data, ajaxSettings.method); module.send.request(); } else { if(!settings.throttleFirstRequest && !module.timer) { module.debug('Sending request', data, ajaxSettings.method); module.send.request(); module.timer = setTimeout(function(){}, settings.throttle); } else { module.debug('Throttling request', settings.throttle); clearTimeout(module.timer); module.timer = setTimeout(function() { if(module.timer) { delete module.timer; } module.debug('Sending throttled request', data, ajaxSettings.method); module.send.request(); }, settings.throttle); } } }, should: { removeError: function() { return ( settings.hideError === true || (settings.hideError === 'auto' && !module.is.form()) ); } }, is: { disabled: function() { return ($module.filter(selector.disabled).length > 0); }, expectingJSON: function() { return settings.dataType === 'json' || settings.dataType === 'jsonp'; }, form: function() { return $module.is('form') || $context.is('form'); }, mocked: function() { return (settings.mockResponse || settings.mockResponseAsync || settings.response || settings.responseAsync); }, input: function() { return $module.is('input'); }, loading: function() { return (module.request) ? (module.request.state() == 'pending') : false ; }, abortedRequest: function(xhr) { if(xhr && xhr.readyState !== undefined && xhr.readyState === 0) { module.verbose('XHR request determined to be aborted'); return true; } else { module.verbose('XHR request was not aborted'); return false; } }, validResponse: function(response) { if( (!module.is.expectingJSON()) || !$.isFunction(settings.successTest) ) { module.verbose('Response is not JSON, skipping validation', settings.successTest, response); return true; } module.debug('Checking JSON returned success', settings.successTest, response); if( settings.successTest(response) ) { module.debug('Response passed success test', response); return true; } else { module.debug('Response failed success test', response); return false; } } }, was: { cancelled: function() { return (module.cancelled || false); }, succesful: function() { return (module.request && module.request.state() == 'resolved'); }, failure: function() { return (module.request && module.request.state() == 'rejected'); }, complete: function() { return (module.request && (module.request.state() == 'resolved' || module.request.state() == 'rejected') ); } }, add: { urlData: function(url, urlData) { var requiredVariables, optionalVariables ; if(url) { requiredVariables = url.match(settings.regExp.required); optionalVariables = url.match(settings.regExp.optional); urlData = urlData || settings.urlData; if(requiredVariables) { module.debug('Looking for required URL variables', requiredVariables); $.each(requiredVariables, function(index, templatedString) { var // allow legacy {$var} style variable = (templatedString.indexOf('$') !== -1) ? templatedString.substr(2, templatedString.length - 3) : templatedString.substr(1, templatedString.length - 2), value = ($.isPlainObject(urlData) && urlData[variable] !== undefined) ? urlData[variable] : ($module.data(variable) !== undefined) ? $module.data(variable) : ($context.data(variable) !== undefined) ? $context.data(variable) : urlData[variable] ; // remove value if(value === undefined) { module.error(error.requiredParameter, variable, url); url = false; return false; } else { module.verbose('Found required variable', variable, value); value = (settings.encodeParameters) ? module.get.urlEncodedValue(value) : value ; url = url.replace(templatedString, value); } }); } if(optionalVariables) { module.debug('Looking for optional URL variables', requiredVariables); $.each(optionalVariables, function(index, templatedString) { var // allow legacy {/$var} style variable = (templatedString.indexOf('$') !== -1) ? templatedString.substr(3, templatedString.length - 4) : templatedString.substr(2, templatedString.length - 3), value = ($.isPlainObject(urlData) && urlData[variable] !== undefined) ? urlData[variable] : ($module.data(variable) !== undefined) ? $module.data(variable) : ($context.data(variable) !== undefined) ? $context.data(variable) : urlData[variable] ; // optional replacement if(value !== undefined) { module.verbose('Optional variable Found', variable, value); url = url.replace(templatedString, value); } else { module.verbose('Optional variable not found', variable); // remove preceding slash if set if(url.indexOf('/' + templatedString) !== -1) { url = url.replace('/' + templatedString, ''); } else { url = url.replace(templatedString, ''); } } }); } } return url; }, formData: function(data) { var canSerialize = ($.fn.serializeObject !== undefined), formData = (canSerialize) ? $form.serializeObject() : $form.serialize(), hasOtherData ; data = data || settings.data; hasOtherData = $.isPlainObject(data); if(hasOtherData) { if(canSerialize) { module.debug('Extending existing data with form data', data, formData); data = $.extend(true, {}, data, formData); } else { module.error(error.missingSerialize); module.debug('Cant extend data. Replacing data with form data', data, formData); data = formData; } } else { module.debug('Adding form data', formData); data = formData; } return data; } }, send: { request: function() { module.set.loading(); module.request = module.create.request(); if( module.is.mocked() ) { module.mockedXHR = module.create.mockedXHR(); } else { module.xhr = module.create.xhr(); } settings.onRequest.call(context, module.request, module.xhr); } }, event: { trigger: function(event) { module.query(); if(event.type == 'submit' || event.type == 'click') { event.preventDefault(); } }, xhr: { always: function() { // nothing special }, done: function(response, textStatus, xhr) { var context = this, elapsedTime = (new Date().getTime() - requestStartTime), timeLeft = (settings.loadingDuration - elapsedTime), translatedResponse = ( $.isFunction(settings.onResponse) ) ? module.is.expectingJSON() ? settings.onResponse.call(context, $.extend(true, {}, response)) : settings.onResponse.call(context, response) : false ; timeLeft = (timeLeft > 0) ? timeLeft : 0 ; if(translatedResponse) { module.debug('Modified API response in onResponse callback', settings.onResponse, translatedResponse, response); response = translatedResponse; } if(timeLeft > 0) { module.debug('Response completed early delaying state change by', timeLeft); } setTimeout(function() { if( module.is.validResponse(response) ) { module.request.resolveWith(context, [response, xhr]); } else { module.request.rejectWith(context, [xhr, 'invalid']); } }, timeLeft); }, fail: function(xhr, status, httpMessage) { var context = this, elapsedTime = (new Date().getTime() - requestStartTime), timeLeft = (settings.loadingDuration - elapsedTime) ; timeLeft = (timeLeft > 0) ? timeLeft : 0 ; if(timeLeft > 0) { module.debug('Response completed early delaying state change by', timeLeft); } setTimeout(function() { if( module.is.abortedRequest(xhr) ) { module.request.rejectWith(context, [xhr, 'aborted', httpMessage]); } else { module.request.rejectWith(context, [xhr, 'error', status, httpMessage]); } }, timeLeft); } }, request: { done: function(response, xhr) { module.debug('Successful API Response', response); if(settings.cache === 'local' && url) { module.write.cachedResponse(url, response); module.debug('Saving server response locally', module.cache); } settings.onSuccess.call(context, response, $module, xhr); }, complete: function(firstParameter, secondParameter) { var xhr, response ; // have to guess callback parameters based on request success if( module.was.succesful() ) { response = firstParameter; xhr = secondParameter; } else { xhr = firstParameter; response = module.get.responseFromXHR(xhr); } module.remove.loading(); settings.onComplete.call(context, response, $module, xhr); }, fail: function(xhr, status, httpMessage) { var // pull response from xhr if available response = module.get.responseFromXHR(xhr), errorMessage = module.get.errorFromRequest(response, status, httpMessage) ; if(status == 'aborted') { module.debug('XHR Aborted (Most likely caused by page navigation or CORS Policy)', status, httpMessage); settings.onAbort.call(context, status, $module, xhr); return true; } else if(status == 'invalid') { module.debug('JSON did not pass success test. A server-side error has most likely occurred', response); } else if(status == 'error') { if(xhr !== undefined) { module.debug('XHR produced a server error', status, httpMessage); // make sure we have an error to display to console if( xhr.status != 200 && httpMessage !== undefined && httpMessage !== '') { module.error(error.statusMessage + httpMessage, ajaxSettings.url); } settings.onError.call(context, errorMessage, $module, xhr); } } if(settings.errorDuration && status !== 'aborted') { module.debug('Adding error state'); module.set.error(); if( module.should.removeError() ) { setTimeout(module.remove.error, settings.errorDuration); } } module.debug('API Request failed', errorMessage, xhr); settings.onFailure.call(context, response, $module, xhr); } } }, create: { request: function() { // api request promise return $.Deferred() .always(module.event.request.complete) .done(module.event.request.done) .fail(module.event.request.fail) ; }, mockedXHR: function () { var // xhr does not simulate these properties of xhr but must return them textStatus = false, status = false, httpMessage = false, responder = settings.mockResponse || settings.response, asyncResponder = settings.mockResponseAsync || settings.responseAsync, asyncCallback, response, mockedXHR ; mockedXHR = $.Deferred() .always(module.event.xhr.complete) .done(module.event.xhr.done) .fail(module.event.xhr.fail) ; if(responder) { if( $.isFunction(responder) ) { module.debug('Using specified synchronous callback', responder); response = responder.call(context, requestSettings); } else { module.debug('Using settings specified response', responder); response = responder; } // simulating response mockedXHR.resolveWith(context, [ response, textStatus, { responseText: response }]); } else if( $.isFunction(asyncResponder) ) { asyncCallback = function(response) { module.debug('Async callback returned response', response); if(response) { mockedXHR.resolveWith(context, [ response, textStatus, { responseText: response }]); } else { mockedXHR.rejectWith(context, [{ responseText: response }, status, httpMessage]); } }; module.debug('Using specified async response callback', asyncResponder); asyncResponder.call(context, requestSettings, asyncCallback); } return mockedXHR; }, xhr: function() { var xhr ; // ajax request promise xhr = $.ajax(ajaxSettings) .always(module.event.xhr.always) .done(module.event.xhr.done) .fail(module.event.xhr.fail) ; module.verbose('Created server request', xhr, ajaxSettings); return xhr; } }, set: { error: function() { module.verbose('Adding error state to element', $context); $context.addClass(className.error); }, loading: function() { module.verbose('Adding loading state to element', $context); $context.addClass(className.loading); requestStartTime = new Date().getTime(); } }, remove: { error: function() { module.verbose('Removing error state from element', $context); $context.removeClass(className.error); }, loading: function() { module.verbose('Removing loading state from element', $context); $context.removeClass(className.loading); } }, get: { responseFromXHR: function(xhr) { return $.isPlainObject(xhr) ? (module.is.expectingJSON()) ? module.decode.json(xhr.responseText) : xhr.responseText : false ; }, errorFromRequest: function(response, status, httpMessage) { return ($.isPlainObject(response) && response.error !== undefined) ? response.error // use json error message : (settings.error[status] !== undefined) // use server error message ? settings.error[status] : httpMessage ; }, request: function() { return module.request || false; }, xhr: function() { return module.xhr || false; }, settings: function() { var runSettings ; runSettings = settings.beforeSend.call(context, settings); if(runSettings) { if(runSettings.success !== undefined) { module.debug('Legacy success callback detected', runSettings); module.error(error.legacyParameters, runSettings.success); runSettings.onSuccess = runSettings.success; } if(runSettings.failure !== undefined) { module.debug('Legacy failure callback detected', runSettings); module.error(error.legacyParameters, runSettings.failure); runSettings.onFailure = runSettings.failure; } if(runSettings.complete !== undefined) { module.debug('Legacy complete callback detected', runSettings); module.error(error.legacyParameters, runSettings.complete); runSettings.onComplete = runSettings.complete; } } if(runSettings === undefined) { module.error(error.noReturnedValue); } if(runSettings === false) { return runSettings; } return (runSettings !== undefined) ? $.extend(true, {}, runSettings) : $.extend(true, {}, settings) ; }, urlEncodedValue: function(value) { var decodedValue = window.decodeURIComponent(value), encodedValue = window.encodeURIComponent(value), alreadyEncoded = (decodedValue !== value) ; if(alreadyEncoded) { module.debug('URL value is already encoded, avoiding double encoding', value); return value; } module.verbose('Encoding value using encodeURIComponent', value, encodedValue); return encodedValue; }, defaultData: function() { var data = {} ; if( !$.isWindow(element) ) { if( module.is.input() ) { data.value = $module.val(); } else if( module.is.form() ) { } else { data.text = $module.text(); } } return data; }, event: function() { if( $.isWindow(element) || settings.on == 'now' ) { module.debug('API called without element, no events attached'); return false; } else if(settings.on == 'auto') { if( $module.is('input') ) { return (element.oninput !== undefined) ? 'input' : (element.onpropertychange !== undefined) ? 'propertychange' : 'keyup' ; } else if( $module.is('form') ) { return 'submit'; } else { return 'click'; } } else { return settings.on; } }, templatedURL: function(action) { action = action || $module.data(metadata.action) || settings.action || false; url = $module.data(metadata.url) || settings.url || false; if(url) { module.debug('Using specified url', url); return url; } if(action) { module.debug('Looking up url for action', action, settings.api); if(settings.api[action] === undefined && !module.is.mocked()) { module.error(error.missingAction, settings.action, settings.api); return; } url = settings.api[action]; } else if( module.is.form() ) { url = $module.attr('action') || $context.attr('action') || false; module.debug('No url or action specified, defaulting to form action', url); } return url; } }, abort: function() { var xhr = module.get.xhr() ; if( xhr && xhr.state() !== 'resolved') { module.debug('Cancelling API request'); xhr.abort(); } }, // reset state reset: function() { module.remove.error(); module.remove.loading(); }, setting: function(name, value) { module.debug('Changing setting', name, value); if( $.isPlainObject(name) ) { $.extend(true, settings, name); } else if(value !== undefined) { if($.isPlainObject(settings[name])) { $.extend(true, settings[name], value); } else { settings[name] = value; } } else { return settings[name]; } }, internal: function(name, value) { if( $.isPlainObject(name) ) { $.extend(true, module, name); } else if(value !== undefined) { module[name] = value; } else { return module[name]; } }, debug: function() { if(!settings.silent && settings.debug) { if(settings.performance) { module.performance.log(arguments); } else { module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':'); module.debug.apply(console, arguments); } } }, verbose: function() { if(!settings.silent && settings.verbose && settings.debug) { if(settings.performance) { module.performance.log(arguments); } else { module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':'); module.verbose.apply(console, arguments); } } }, error: function() { if(!settings.silent) { module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); module.error.apply(console, arguments); } }, performance: { log: function(message) { var currentTime, executionTime, previousTime ; if(settings.performance) { currentTime = new Date().getTime(); previousTime = time || currentTime; executionTime = currentTime - previousTime; time = currentTime; performance.push({ 'Name' : message[0], 'Arguments' : [].slice.call(message, 1) || '', //'Element' : element, 'Execution Time' : executionTime }); } clearTimeout(module.performance.timer); module.performance.timer = setTimeout(module.performance.display, 500); }, display: function() { var title = settings.name + ':', totalTime = 0 ; time = false; clearTimeout(module.performance.timer); $.each(performance, function(index, data) { totalTime += data['Execution Time']; }); title += ' ' + totalTime + 'ms'; if(moduleSelector) { title += ' \'' + moduleSelector + '\''; } if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) { console.groupCollapsed(title); if(console.table) { console.table(performance); } else { $.each(performance, function(index, data) { console.log(data['Name'] + ': ' + data['Execution Time']+'ms'); }); } console.groupEnd(); } performance = []; } }, invoke: function(query, passedArguments, context) { var object = instance, maxDepth, found, response ; passedArguments = passedArguments || queryArguments; context = element || context; if(typeof query == 'string' && object !== undefined) { query = query.split(/[\. ]/); maxDepth = query.length - 1; $.each(query, function(depth, value) { var camelCaseValue = (depth != maxDepth) ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1) : query ; if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) { object = object[camelCaseValue]; } else if( object[camelCaseValue] !== undefined ) { found = object[camelCaseValue]; return false; } else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) { object = object[value]; } else if( object[value] !== undefined ) { found = object[value]; return false; } else { module.error(error.method, query); return false; } }); } if ( $.isFunction( found ) ) { response = found.apply(context, passedArguments); } else if(found !== undefined) { response = found; } if($.isArray(returnedValue)) { returnedValue.push(response); } else if(returnedValue !== undefined) { returnedValue = [returnedValue, response]; } else if(response !== undefined) { returnedValue = response; } return found; } }; if(methodInvoked) { if(instance === undefined) { module.initialize(); } module.invoke(query); } else { if(instance !== undefined) { instance.invoke('destroy'); } module.initialize(); } }) ; return (returnedValue !== undefined) ? returnedValue : this ; }; $.api.settings = { name : 'API', namespace : 'api', debug : false, verbose : false, performance : true, // object containing all templates endpoints api : {}, // whether to cache responses cache : true, // whether new requests should abort previous requests interruptRequests : true, // event binding on : 'auto', // context for applying state classes stateContext : false, // duration for loading state loadingDuration : 0, // whether to hide errors after a period of time hideError : 'auto', // duration for error state errorDuration : 2000, // whether parameters should be encoded with encodeURIComponent encodeParameters : true, // API action to use action : false, // templated URL to use url : false, // base URL to apply to all endpoints base : '', // data that will urlData : {}, // whether to add default data to url data defaultData : true, // whether to serialize closest form serializeForm : false, // how long to wait before request should occur throttle : 0, // whether to throttle first request or only repeated throttleFirstRequest : true, // standard ajax settings method : 'get', data : {}, dataType : 'json', // mock response mockResponse : false, mockResponseAsync : false, // aliases for mock response : false, responseAsync : false, // callbacks before request beforeSend : function(settings) { return settings; }, beforeXHR : function(xhr) {}, onRequest : function(promise, xhr) {}, // after request onResponse : false, // function(response) { }, // response was successful, if JSON passed validation onSuccess : function(response, $module) {}, // request finished without aborting onComplete : function(response, $module) {}, // failed JSON success test onFailure : function(response, $module) {}, // server error onError : function(errorMessage, $module) {}, // request aborted onAbort : function(errorMessage, $module) {}, successTest : false, // errors error : { beforeSend : 'The before send function has aborted the request', error : 'There was an error with your request', exitConditions : 'API Request Aborted. Exit conditions met', JSONParse : 'JSON could not be parsed during error handling', legacyParameters : 'You are using legacy API success callback names', method : 'The method you called is not defined', missingAction : 'API action used but no url was defined', missingSerialize : 'jquery-serialize-object is required to add form data to an existing data object', missingURL : 'No URL specified for api event', noReturnedValue : 'The beforeSend callback must return a settings object, beforeSend ignored.', noStorage : 'Caching responses locally requires session storage', parseError : 'There was an error parsing your request', requiredParameter : 'Missing a required URL parameter: ', statusMessage : 'Server gave an error: ', timeout : 'Your request timed out' }, regExp : { required : /\{\$*[A-z0-9]+\}/g, optional : /\{\/\$*[A-z0-9]+\}/g, }, className: { loading : 'loading', error : 'error' }, selector: { disabled : '.disabled', form : 'form' }, metadata: { action : 'action', url : 'url' } }; })( jQuery, window, document ); /*! * # Semantic UI - Checkbox * http://github.com/semantic-org/semantic-ui/ * * * Released under the MIT license * http://opensource.org/licenses/MIT * */ ;(function ($, window, document, undefined) { 'use strict'; window = (typeof window != 'undefined' && window.Math == Math) ? window : (typeof self != 'undefined' && self.Math == Math) ? self : Function('return this')() ; $.fn.checkbox = function(parameters) { var $allModules = $(this), moduleSelector = $allModules.selector || '', time = new Date().getTime(), performance = [], query = arguments[0], methodInvoked = (typeof query == 'string'), queryArguments = [].slice.call(arguments, 1), returnedValue ; $allModules .each(function() { var settings = $.extend(true, {}, $.fn.checkbox.settings, parameters), className = settings.className, namespace = settings.namespace, selector = settings.selector, error = settings.error, eventNamespace = '.' + namespace, moduleNamespace = 'module-' + namespace, $module = $(this), $label = $(this).children(selector.label), $input = $(this).children(selector.input), input = $input[0], initialLoad = false, shortcutPressed = false, instance = $module.data(moduleNamespace), observer, element = this, module ; module = { initialize: function() { module.verbose('Initializing checkbox', settings); module.create.label(); module.bind.events(); module.set.tabbable(); module.hide.input(); module.observeChanges(); module.instantiate(); module.setup(); }, instantiate: function() { module.verbose('Storing instance of module', module); instance = module; $module .data(moduleNamespace, module) ; }, destroy: function() { module.verbose('Destroying module'); module.unbind.events(); module.show.input(); $module.removeData(moduleNamespace); }, fix: { reference: function() { if( $module.is(selector.input) ) { module.debug('Behavior called on adjusting invoked element'); $module = $module.closest(selector.checkbox); module.refresh(); } } }, setup: function() { module.set.initialLoad(); if( module.is.indeterminate() ) { module.debug('Initial value is indeterminate'); module.indeterminate(); } else if( module.is.checked() ) { module.debug('Initial value is checked'); module.check(); } else { module.debug('Initial value is unchecked'); module.uncheck(); } module.remove.initialLoad(); }, refresh: function() { $label = $module.children(selector.label); $input = $module.children(selector.input); input = $input[0]; }, hide: { input: function() { module.verbose('Modifying z-index to be unselectable'); $input.addClass(className.hidden); } }, show: { input: function() { module.verbose('Modifying z-index to be selectable'); $input.removeClass(className.hidden); } }, observeChanges: function() { if('MutationObserver' in window) { observer = new MutationObserver(function(mutations) { module.debug('DOM tree modified, updating selector cache'); module.refresh(); }); observer.observe(element, { childList : true, subtree : true }); module.debug('Setting up mutation observer', observer); } }, attachEvents: function(selector, event) { var $element = $(selector) ; event = $.isFunction(module[event]) ? module[event] : module.toggle ; if($element.length > 0) { module.debug('Attaching checkbox events to element', selector, event); $element .on('click' + eventNamespace, event) ; } else { module.error(error.notFound); } }, event: { click: function(event) { var $target = $(event.target) ; if( $target.is(selector.input) ) { module.verbose('Using default check action on initialized checkbox'); return; } if( $target.is(selector.link) ) { module.debug('Clicking link inside checkbox, skipping toggle'); return; } module.toggle(); $input.focus(); event.preventDefault(); }, keydown: function(event) { var key = event.which, keyCode = { enter : 13, space : 32, escape : 27 } ; if(key == keyCode.escape) { module.verbose('Escape key pressed blurring field'); $input.blur(); shortcutPressed = true; } else if(!event.ctrlKey && ( key == keyCode.space || key == keyCode.enter) ) { module.verbose('Enter/space key pressed, toggling checkbox'); module.toggle(); shortcutPressed = true; } else { shortcutPressed = false; } }, keyup: function(event) { if(shortcutPressed) { event.preventDefault(); } } }, check: function() { if( !module.should.allowCheck() ) { return; } module.debug('Checking checkbox', $input); module.set.checked(); if( !module.should.ignoreCallbacks() ) { settings.onChecked.call(input); settings.onChange.call(input); } }, uncheck: function() { if( !module.should.allowUncheck() ) { return; } module.debug('Unchecking checkbox'); module.set.unchecked(); if( !module.should.ignoreCallbacks() ) { settings.onUnchecked.call(input); settings.onChange.call(input); } }, indeterminate: function() { if( module.should.allowIndeterminate() ) { module.debug('Checkbox is already indeterminate'); return; } module.debug('Making checkbox indeterminate'); module.set.indeterminate(); if( !module.should.ignoreCallbacks() ) { settings.onIndeterminate.call(input); settings.onChange.call(input); } }, determinate: function() { if( module.should.allowDeterminate() ) { module.debug('Checkbox is already determinate'); return; } module.debug('Making checkbox determinate'); module.set.determinate(); if( !module.should.ignoreCallbacks() ) { settings.onDeterminate.call(input); settings.onChange.call(input); } }, enable: function() { if( module.is.enabled() ) { module.debug('Checkbox is already enabled'); return; } module.debug('Enabling checkbox'); module.set.enabled(); settings.onEnable.call(input); // preserve legacy callbacks settings.onEnabled.call(input); }, disable: function() { if( module.is.disabled() ) { module.debug('Checkbox is already disabled'); return; } module.debug('Disabling checkbox'); module.set.disabled(); settings.onDisable.call(input); // preserve legacy callbacks settings.onDisabled.call(input); }, get: { radios: function() { var name = module.get.name() ; return $('input[name="' + name + '"]').closest(selector.checkbox); }, otherRadios: function() { return module.get.radios().not($module); }, name: function() { return $input.attr('name'); } }, is: { initialLoad: function() { return initialLoad; }, radio: function() { return ($input.hasClass(className.radio) || $input.attr('type') == 'radio'); }, indeterminate: function() { return $input.prop('indeterminate') !== undefined && $input.prop('indeterminate'); }, checked: function() { return $input.prop('checked') !== undefined && $input.prop('checked'); }, disabled: function() { return $input.prop('disabled') !== undefined && $input.prop('disabled'); }, enabled: function() { return !module.is.disabled(); }, determinate: function() { return !module.is.indeterminate(); }, unchecked: function() { return !module.is.checked(); } }, should: { allowCheck: function() { if(module.is.determinate() && module.is.checked() && !module.should.forceCallbacks() ) { module.debug('Should not allow check, checkbox is already checked'); return false; } if(settings.beforeChecked.apply(input) === false) { module.debug('Should not allow check, beforeChecked cancelled'); return false; } return true; }, allowUncheck: function() { if(module.is.determinate() && module.is.unchecked() && !module.should.forceCallbacks() ) { module.debug('Should not allow uncheck, checkbox is already unchecked'); return false; } if(settings.beforeUnchecked.apply(input) === false) { module.debug('Should not allow uncheck, beforeUnchecked cancelled'); return false; } return true; }, allowIndeterminate: function() { if(module.is.indeterminate() && !module.should.forceCallbacks() ) { module.debug('Should not allow indeterminate, checkbox is already indeterminate'); return false; } if(settings.beforeIndeterminate.apply(input) === false) { module.debug('Should not allow indeterminate, beforeIndeterminate cancelled'); return false; } return true; }, allowDeterminate: function() { if(module.is.determinate() && !module.should.forceCallbacks() ) { module.debug('Should not allow determinate, checkbox is already determinate'); return false; } if(settings.beforeDeterminate.apply(input) === false) { module.debug('Should not allow determinate, beforeDeterminate cancelled'); return false; } return true; }, forceCallbacks: function() { return (module.is.initialLoad() && settings.fireOnInit); }, ignoreCallbacks: function() { return (initialLoad && !settings.fireOnInit); } }, can: { change: function() { return !( $module.hasClass(className.disabled) || $module.hasClass(className.readOnly) || $input.prop('disabled') || $input.prop('readonly') ); }, uncheck: function() { return (typeof settings.uncheckable === 'boolean') ? settings.uncheckable : !module.is.radio() ; } }, set: { initialLoad: function() { initialLoad = true; }, checked: function() { module.verbose('Setting class to checked'); $module .removeClass(className.indeterminate) .addClass(className.checked) ; if( module.is.radio() ) { module.uncheckOthers(); } if(!module.is.indeterminate() && module.is.checked()) { module.debug('Input is already checked, skipping input property change'); return; } module.verbose('Setting state to checked', input); $input .prop('indeterminate', false) .prop('checked', true) ; module.trigger.change(); }, unchecked: function() { module.verbose('Removing checked class'); $module .removeClass(className.indeterminate) .removeClass(className.checked) ; if(!module.is.indeterminate() && module.is.unchecked() ) { module.debug('Input is already unchecked'); return; } module.debug('Setting state to unchecked'); $input .prop('indeterminate', false) .prop('checked', false) ; module.trigger.change(); }, indeterminate: function() { module.verbose('Setting class to indeterminate'); $module .addClass(className.indeterminate) ; if( module.is.indeterminate() ) { module.debug('Input is already indeterminate, skipping input property change'); return; } module.debug('Setting state to indeterminate'); $input .prop('indeterminate', true) ; module.trigger.change(); }, determinate: function() { module.verbose('Removing indeterminate class'); $module .removeClass(className.indeterminate) ; if( module.is.determinate() ) { module.debug('Input is already determinate, skipping input property change'); return; } module.debug('Setting state to determinate'); $input .prop('indeterminate', false) ; }, disabled: function() { module.verbose('Setting class to disabled'); $module .addClass(className.disabled) ; if( module.is.disabled() ) { module.debug('Input is already disabled, skipping input property change'); return; } module.debug('Setting state to disabled'); $input .prop('disabled', 'disabled') ; module.trigger.change(); }, enabled: function() { module.verbose('Removing disabled class'); $module.removeClass(className.disabled); if( module.is.enabled() ) { module.debug('Input is already enabled, skipping input property change'); return; } module.debug('Setting state to enabled'); $input .prop('disabled', false) ; module.trigger.change(); }, tabbable: function() { module.verbose('Adding tabindex to checkbox'); if( $input.attr('tabindex') === undefined) { $input.attr('tabindex', 0); } } }, remove: { initialLoad: function() { initialLoad = false; } }, trigger: { change: function() { var events = document.createEvent('HTMLEvents'), inputElement = $input[0] ; if(inputElement) { module.verbose('Triggering native change event'); events.initEvent('change', true, false); inputElement.dispatchEvent(events); } } }, create: { label: function() { if($input.prevAll(selector.label).length > 0) { $input.prev(selector.label).detach().insertAfter($input); module.debug('Moving existing label', $label); } else if( !module.has.label() ) { $label = $('