text: define(["exports"],function(_exports){"use strict";Object.defineProperty(_exports,"__esModule",{value:!0});_exports.SecureRequestXhr=void 0;/**
   * `secure-request`
   * `Wrapper behavior to provide the basis for a secure XHR`
   *
   * @demo demo/index.html
   * @polymerBehavior
   * @polymer
   */ // superclass element mix in
  var SecureRequestXhr=function SecureRequestXhr(SuperClass){return(/*#__PURE__*/function(_SuperClass){babelHelpers.inherits(_class,_SuperClass);function _class(){babelHelpers.classCallCheck(this,_class);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(_class).apply(this,arguments))}babelHelpers.createClass(_class,[{key:"setCookies",/**
       * Set cookies for the request
       */value:function setCookies(endPoint,csrfToken){this._eraseCookie("securerequest-endpoint");this._eraseCookie("securerequest-csrftoken");this._createCookie("securerequest-endpoint",endPoint,30,endPoint);this._createCookie("securerequest-csrftoken",csrfToken,30,endPoint)}// call this function from your child components to generate secure urls
  },{key:"generateUrl",value:function generateUrl(url){var endPoint=this.getEndPoint(),csrfToken=this.getCsrfToken();if(endPoint&&csrfToken){return endPoint+url+"?token="+csrfToken}return null}},{key:"getEndPoint",value:function getEndPoint(){return this._readCookie("securerequest-endpoint")}},{key:"getCsrfToken",value:function getCsrfToken(){return this._readCookie("securerequest-csrftoken")}},{key:"_createCookie",value:function _createCookie(name,value,days,path){var expires="";if(days){var date=new Date;date.setTime(date.getTime()+1e3*(60*(60*(24*days))));expires="; expires="+date.toUTCString()}document.cookie=name+"="+value+expires+"; path="+path}},{key:"_readCookie",value:function _readCookie(name){for(var nameEQ=name+"=",ca=document.cookie.split(";"),i=0,c;i<ca.length;i++){c=ca[i];while(" "==c.charAt(0)){c=c.substring(1,c.length)}if(0==c.indexOf(nameEQ))return c.substring(nameEQ.length,c.length)}return null}},{key:"_eraseCookie",value:function _eraseCookie(name){this._createCookie(name,"",-1)}}]);return _class}(SuperClass))};_exports.SecureRequestXhr=SecureRequestXhr;window.SecureRequest=window.SecureRequest||{};window.SecureRequest.xhr={// Call this function in your root component.
  setCookies:function setCookies(endPoint,csrfToken){this._eraseCookie("securerequest-endpoint");this._eraseCookie("securerequest-csrftoken");this._createCookie("securerequest-endpoint",endPoint,30,endPoint);this._createCookie("securerequest-csrftoken",csrfToken,30,endPoint)},// call this function from your child components to generate secure urls
  generateUrl:function generateUrl(url){var endPoint=this.getEndPoint(),csrfToken=this.getCsrfToken();if(endPoint&&csrfToken){return endPoint+url+"?token="+csrfToken}return null},getEndPoint:function getEndPoint(){return this._readCookie("securerequest-endpoint")},getCsrfToken:function getCsrfToken(){return this._readCookie("securerequest-csrftoken")},_createCookie:function _createCookie(name,value,days,path){var expires="";if(days){var date=new Date;date.setTime(date.getTime()+1e3*(60*(60*(24*days))));expires="; expires="+date.toUTCString()}document.cookie=name+"="+value+expires+"; path="+path},_readCookie:function _readCookie(name){for(var nameEQ=name+"=",ca=document.cookie.split(";"),i=0,c;i<ca.length;i++){c=ca[i];while(" "==c.charAt(0)){c=c.substring(1,c.length)}if(0==c.indexOf(nameEQ))return c.substring(nameEQ.length,c.length)}return null},_eraseCookie:function _eraseCookie(name){this._createCookie(name,"",-1)}}});