Socket
Socket
Sign inDemoInstall

prismic.io

Package Overview
Dependencies
0
Maintainers
3
Versions
77
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.7 to 1.1.8

dist/prismic.io-1.1.8.min.js

2

dist/prismic.io.min.js

@@ -1,1 +0,1 @@

!function(){"function"!=typeof Object.create&&(Object.create=function(){var t=function(){};return function(e){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof e)throw TypeError("Argument must be an object");t.prototype=e;var n={};return t.prototype=null,n}}())}(),function(t,e){"use strict";function n(t,e,n,r,i,o){this.name=t,this.fields=e,this.form_method=n,this.rel=r,this.enctype=i,this.action=o}function r(t,e,n){this.api=t,this.form=e,this.data=n||{};for(var r in e.fields)e.fields[r]["default"]&&(this.data[r]=[e.fields[r]["default"]])}function i(t,e,n,r,i,o,s,a){this.page=t,this.results_per_page=e,this.results_size=n,this.total_results_size=r,this.total_pages=i,this.next_page=o,this.prev_page=s,this.results=a}function o(t,e,n,r,i){this.ref=t,this.label=e,this.isMaster=n,this.scheduledAt=r,this.id=i}function s(){var e;return e="object"==typeof global?global:window,e.prismicCache||(e.prismicCache=new t.Prismic.ApiCache),e.prismicCache}var a=function(e,n,r,i,o,s){var u=new a.fn.init(e,r,i,o,s);return u.get(function(e,r){return n&&e?n(e):(r&&(u.data=r,u.bookmarks=r.bookmarks,u.experiments=new t.Prismic.Experiments(r.experiments)),n?n(null,u):void 0)}),u};a.fn=a.prototype={AT:"at",ANY:"any",SIMILAR:"similar",FULLTEXT:"fulltext",NUMBER:{GT:"number.gt",LT:"number.lt"},DATE:{AFTER:"date.after",BEFORE:"date.before",BETWEEN:"date.between"},DOCUMENT:{ID:"document.id",TYPE:"document.type",TAGS:"document.tags"},constructor:a,data:null,get:function(t){var e=this,n=this.apiCacheKey;this.apiCache.get(n,function(r,i){return r?t(r):i?t(null,i):void e.requestHandler(e.url,function(r,i,o,s){if(r)return t(r,null,o);var a=e.parse(i);s|=e.apiDataTTL,e.apiCache.set(n,a,s,function(e){return e?t(e,null,o):t(null,a,o)})})})},refresh:function(e){var n=this,r=this.apiCacheKey;this.apiCache.remove(r,function(r){if(e&&r)return e(r);if(!e&&r)throw r;n.get(function(r,i){if(e&&r)return e(r);if(!e&&r)throw r;return n.data=i,n.bookmarks=i.bookmarks,n.experiments=new t.Prismic.Experiments(i.experiments),e?e():void 0})})},parse:function(t){var e,r,i,s,a,u,l,c={};for(l in t.forms)t.forms.hasOwnProperty(l)&&(u=t.forms[l],this.accessToken&&(u.fields.access_token={},u.fields.access_token.type="string",u.fields.access_token["default"]=this.accessToken),i=new n(u.name,u.fields,u.form_method,u.rel,u.enctype,u.action),c[l]=i);if(e=t.refs.map(function(t){return new o(t.ref,t.label,t.isMasterRef,t.scheduledAt,t.id)})||[],r=e.filter(function(t){return t.isMaster===!0}),s=t.types,a=t.tags,0===r.length)throw"No master ref.";return{bookmarks:t.bookmarks||{},refs:e,forms:c,master:r[0],types:s,tags:a,experiments:t.experiments,oauthInitiate:t.oauth_initiate,oauthToken:t.oauth_token}},init:function(e,n,r,i,o){return this.url=e+(n?(e.indexOf("?")>-1?"&":"?")+"access_token="+n:""),this.accessToken=n,this.apiCache=i||s(),this.requestHandler=r||t.Prismic.Utils.request(),this.apiCacheKey=this.url+(this.accessToken?"#"+this.accessToken:""),this.apiDataTTL=o||5,this},forms:function(t){return this.form(t)},form:function(t){var e=this.data.forms[t];return e?new r(this,e,{}):void 0},master:function(){return this.data.master.ref},ref:function(t){for(var e=0;e<this.data.refs.length;e++)if(this.data.refs[e].label==t)return this.data.refs[e].ref},currentExperiment:function(){return this.experiments.current()},parseDoc:function(n){var r={};for(var i in n.data[n.type])r[n.type+"."+i]=n.data[n.type][i];var o=[];if(n.slugs!==e)for(var s=0;s<n.slugs.length;s++)o.push(decodeURIComponent(n.slugs[s]));return new t.Prismic.Document(n.id,n.uid||null,n.type,n.href,n.tags,o,r)},previewSession:function(e,n,r,i){var o=this,s=t.Prismic.Predicates;this.requestHandler(e,function(t,a,u){if(t)return console.log("Error from the request"),void i(t,r,u);try{var l=a.mainDocument;l?o.form("everything").query(s.at("document.id",l)).ref(e).submit(function(t,e){0===e.results.length?i(null,r,u):i(null,n(e.results[0]),u)}):i(null,r,u)}catch(c){console.log("Caught e ",c),i(c,r,u)}})},request:function(t,e){var n=this,r=t+(this.accessToken?"#"+this.accessToken:""),o=this.apiCache;o.get(r,function(s,u){return s?e(s):u?e(null,u):void n.requestHandler(t,function(t,n,s,u){if(t)return void e(t,null,s);var l=n.results.map(a.fn.parseDoc),c=new i(n.page,n.results_per_page,n.results_size,n.total_results_size,n.total_pages,n.next_page,n.prev_page,l||[]);return u?void o.set(r,c,u,function(t){return t?e(t):e(null,c)}):e(null,c)})})}},a.fn.init.prototype=a.fn,n.prototype={},r.prototype={set:function(t,n){var r=this.form.fields[t];if(!r)throw new Error("Unknown field "+t);var i=this.data[t]||[];return(""===n||n===e)&&(n=null),r.multiple?n&&i.push(n):i=n&&[n],this.data[t]=i,this},ref:function(t){return this.set("ref",t)},query:function(t){if("string"==typeof t)return this.set("q",t);var e=[].slice.apply(arguments),n=[];return e.forEach(function(t){var e=0===t[1].indexOf("my.")||0===t[1].indexOf("document")?t[1]:'"'+t[1]+'"';n.push("[:d = "+t[0]+"("+e+", "+function(){return t.slice(2).map(function(t){return"string"==typeof t?'"'+t+'"':Array.isArray(t)?"["+t.map(function(t){return'"'+t+'"'}).join(",")+"]":t instanceof Date?t.getTime():t}).join(",")}()+")]")}),this.query("["+n.join("")+"]")},pageSize:function(t){return this.set("pageSize",t)},fetch:function(t){return t instanceof Array&&(t=t.join(",")),this.set("fetch",t)},fetchLinks:function(t){return t instanceof Array&&(t=t.join(",")),this.set("fetchLinks",t)},page:function(t){return this.set("page",t)},orderings:function(t){return"string"==typeof t?this.set("orderings",t):t?this.set("orderings","["+t.join(",")+"]"):this},submit:function(t){var e=this.form.action;if(this.data){var n=e.indexOf("?")>-1?"&":"?";for(var r in this.data)if(this.data.hasOwnProperty(r)){var i=this.data[r];if(i)for(var o=0;o<i.length;o++)e+=n+r+"="+encodeURIComponent(i[o]),n="&"}}this.api.request(e,t)}},o.prototype={},t.Prismic={experimentCookie:"io.prismic.experiment",previewCookie:"io.prismic.preview",Api:a}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t,e){function n(t){this.size=0,this.limit=t,this._keymap={}}n.prototype.put=function(t,e){var n={key:t,value:e};return this._keymap[t]=n,this.tail?(this.tail.newer=n,n.older=this.tail):this.head=n,this.tail=n,this.size===this.limit?this.shift():void this.size++},n.prototype.shift=function(){var t=this.head;return t&&(this.head.newer?(this.head=this.head.newer,this.head.older=e):this.head=e,t.newer=t.older=e,delete this._keymap[t.key]),t},n.prototype.get=function(t,n){var r=this._keymap[t];if(r!==e)return r===this.tail?n?r:r.value:(r.newer&&(r===this.head&&(this.head=r.newer),r.newer.older=r.older),r.older&&(r.older.newer=r.newer),r.newer=e,r.older=this.tail,this.tail&&(this.tail.newer=r),this.tail=r,n?r:r.value)},n.prototype.find=function(t){return this._keymap[t]},n.prototype.set=function(t,e){var n,r=this.get(t,!0);return r?(n=r.value,r.value=e):(n=this.put(t,e),n&&(n=n.value)),n},n.prototype.remove=function(t){var n=this._keymap[t];if(n)return delete this._keymap[n.key],n.newer&&n.older?(n.older.newer=n.newer,n.newer.older=n.older):n.newer?(n.newer.older=e,this.head=n.newer):n.older?(n.older.newer=e,this.tail=n.older):this.head=this.tail=e,this.size--,n.value},n.prototype.removeAll=function(){this.head=this.tail=e,this.size=0,this._keymap={}},n.prototype.keys="function"==typeof Object.keys?function(){return Object.keys(this._keymap)}:function(){var t=[];for(var e in this._keymap)t.push(e);return t},n.prototype.forEach=function(t,n,r){var i;if(n===!0?(r=!0,n=e):"object"!=typeof n&&(n=this),r)for(i=this.tail;i;)t.call(n,i.key,i.value,this),i=i.older;else for(i=this.head;i;)t.call(n,i.key,i.value,this),i=i.newer},n.prototype.toJSON=function(){for(var t=[],e=this.head;e;)t.push({key:e.key.toJSON(),value:e.value.toJSON()}),e=e.newer;return t},n.prototype.toString=function(){for(var t="",e=this.head;e;)t+=String(e.key)+":"+e.value,e=e.newer,e&&(t+=" < ");return t},t.Prismic.LRUCache=n}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";function e(e){this.lru=new t.Prismic.LRUCache(e)}e.prototype={get:function(t,e){var n=this.lru.get(t);return n&&!this.isExpired(t)?e(null,n.data):e()},set:function(t,e,n,r){return this.lru.remove(t),this.lru.put(t,{data:e,expiredIn:n?Date.now()+1e3*n:0}),r()},isExpired:function(t){var e=this.lru.get(t);return e?0!==e.expiredIn&&e.expiredIn<Date.now():!1},remove:function(t,e){return this.lru.remove(t),e()},clear:function(t){return this.lru.removeAll(),t()}},t.Prismic.ApiCache=e}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t,e){"use strict";var n=function(){return"undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest?function(t,e){var n=new XMLHttpRequest,r=function(){var t,r=/max-age\s*=\s*(\d+)/.exec(n.getResponseHeader("Cache-Control"));r&&r.length>1&&(t=parseInt(r[1],10)),e(null,JSON.parse(n.responseText),n,t)},i=function(){var r=n.status;e(new Error("Unexpected status code ["+r+"] on URL "+t),null,n)};n.onreadystatechange=function(){4===n.readyState&&(n.status&&200==n.status?r():i())},n.open("GET",t,!0),n.setRequestHeader("Accept","application/json"),n.send()}:void 0},r=function(){return"undefined"!=typeof XDomainRequest?function(t,e){var n=new XDomainRequest,r=function(){var t,r=/max-age\s*=\s*(\d+)/.exec(xhr.getResponseHeader("Cache-Control"));r&&r.length>1&&(t=parseInt(r[1],10)),e(null,JSON.parse(n.responseText),n,t)},i=function(t){e(new Error(t),null,n)};n.onload=function(){r(n)},n.onerror=function(){i("Unexpected status code on URL "+t)},n.open("GET",t,!0),n.ontimeout=function(){i("Request timeout")},n.onprogress=function(){},n.send()}:void 0},i=function(){if("function"==typeof require&&require("http")){var t=require("http"),n=require("https"),r=require("url"),i=(require("querystring"),require("../package.json"));return function(o,s){var a=r.parse(o),u="https:"==a.protocol?n:t,l={hostname:a.hostname,path:a.path,query:a.query,headers:{Accept:"application/json","User-Agent":"Prismic-javascript-kit/"+i.version+" NodeJS/"+process.version}};u.get(l,function(t){if(t.statusCode&&200==t.statusCode){var n="";t.setEncoding("utf8"),t.on("data",function(t){n+=t}),t.on("end",function(){var r=JSON.parse(n),i=t.headers["cache-control"],o=i&&/max-age=(\d+)/.test(i)?parseInt(/max-age=(\d+)/.exec(i)[1],10):e;s(null,r,t,o)})}else s(new Error("Unexpected status code ["+t.statusCode+"] on URL "+o),null,t)})}}},o=0,s=[],a=function(){if(!(0===s.length||o>=t.Prismic.Utils.MAX_CONNECTIONS)){o++;var e=s.shift(),u=n()||r()||i()||function(){throw new Error("No request handler available (tried XMLHttpRequest & NodeJS)")}();u.call(this,e.url,function(t,n,r,i){o--,e.callback(t,n,r,i),a()})}},u=function(){return function(t,e){s.push({url:t,callback:e}),a()}};t.Prismic.Utils={MAX_CONNECTIONS:20,request:u}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";function e(){}function n(t,e,n,r,i,o,s){this.id=t,this.uid=e,this.type=n,this.href=r,this.tags=i,this.slug=o?o[0]:"-",this.slugs=o,this.fragments=s}function r(t){this.fragments=t}function i(t){var e={};return t&&"[object Function]"===e.toString.call(t)}e.prototype={get:function(e){var n=this._getFragments(e);return n.length?t.Prismic.Fragments.initField(n[0]):null},getAll:function(e){return this._getFragments(e).map(function(e){return t.Prismic.Fragments.initField(e)},this)},getImage:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Image?n:n instanceof t.Prismic.Fragments.StructuredText?n:null},getAllImages:function(e){var n=this.getAll(e);return n.map(function(e){if(e instanceof t.Prismic.Fragments.Image)return e;if(e instanceof t.Prismic.Fragments.StructuredText)throw new Error("Not done.");return null})},getImageView:function(e,n){var r=this.get(e);if(r instanceof t.Prismic.Fragments.Image)return r.getView(n);if(r instanceof t.Prismic.Fragments.StructuredText)for(var i=0;i<r.blocks.length;i++)if("image"==r.blocks[i].type)return r.blocks[i];return null},getAllImageViews:function(t,e){return this.getAllImages(t).map(function(t){return t.getView(e)})},getTimestamp:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Timestamp?n.value:void 0},getDate:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Date?n.value:void 0},getBoolean:function(t){var e=this.get(t);return e.value&&("yes"==e.value.toLowerCase()||"on"==e.value.toLowerCase()||"true"==e.value.toLowerCase())},getText:function(e,n){var r=this.get(e);return r instanceof t.Prismic.Fragments.StructuredText?r.blocks.map(function(t){return t.text?t.text+(n?n:""):void 0}).join("\n"):r instanceof t.Prismic.Fragments.Text&&r.value?r.value+(n?n:""):r instanceof t.Prismic.Fragments.Number&&r.value?r.value+(n?n:""):r instanceof t.Prismic.Fragments.Select&&r.value?r.value+(n?n:""):r instanceof t.Prismic.Fragments.Color&&r.value?r.value+(n?n:""):void 0},getStructuredText:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.StructuredText?n:null},getLink:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.WebLink||n instanceof t.Prismic.Fragments.DocumentLink||n instanceof t.Prismic.Fragments.ImageLink?n:null},getNumber:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Number?n.value:null},getColor:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Color?n.value:null},getGeoPoint:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.GeoPoint?n:null},getGroup:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Group?n:null},getSliceZone:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.SliceZone?n:null},getHtml:function(t,e){if(!i(e)){var n=e;e=function(t,e){return n.linkResolver(n,t,e)}}var r=this.get(t);return r&&r.asHtml?r.asHtml(e):null},asHtml:function(t){if(!i(t)){var e=t;t=function(t,n){return e.linkResolver(e,t,n)}}var n=[];for(var r in this.fragments){var o=this.get(r);n.push(o&&o.asHtml?'<section data-field="'+r+'">'+o.asHtml(t)+"</section>":"")}return n.join("")},asText:function(t){if(!i(t)){var e=t;t=function(t,n){return e.linkResolver(e,t,n)}}var n=[];for(var r in this.fragments){var o=this.get(r);n.push(o&&o.asText?o.asText(t):"")}return n.join("")},linkedDocuments:function(){var e,n,r,i=[];for(var o in this.fragments){var s=this.get(o);if(s instanceof t.Prismic.Fragments.DocumentLink&&i.push(s),s instanceof t.Prismic.Fragments.StructuredText)for(e=0;e<s.blocks.length;e++){var a=s.blocks[e];"image"==a.type&&a.linkTo&&(r=t.Prismic.Fragments.initField(a.linkTo),r instanceof DocumentLink&&i.push(r));var u=a.spans||[];for(n=0;n<u.length;n++){var l=u[n];"hyperlink"==l.type&&(r=t.Prismic.Fragments.initField(l.data),r instanceof t.Prismic.Fragments.DocumentLink&&i.push(r))}}if(s instanceof t.Prismic.Fragments.Group)for(e=0;e<s.value.length;e++)i=i.concat(s.value[e].linkedDocuments())}return i},_getFragments:function(t){return this.fragments&&this.fragments[t]?Array.isArray(this.fragments[t])?this.fragments[t]:[this.fragments[t]]:[]}},n.prototype=Object.create(e.prototype),r.prototype=Object.create(e.prototype),t.Prismic.WithFragments=e,t.Prismic.Document=n,t.Prismic.GroupDoc=r}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";function e(t){this.value=t}function n(t){this.value=t,this.document=t.document,this.id=t.document.id,this.uid=t.document.uid,this.tags=t.document.tags,this.slug=t.document.slug,this.type=t.document.type;var e={};if(t.document.data)for(var n in t.document.data[t.document.type])e[t.document.type+"."+n]=t.document.data[t.document.type][n];this.fragments=e,this.isBroken=t.isBroken}function r(t){this.value=t}function i(t){this.value=t}function o(t){this.value=t}function s(t){this.value=t}function a(t){this.value=t}function u(t){this.latitude=t.latitude,this.longitude=t.longitude}function l(t){this.value=t}function c(t){this.value=new Date(t)}function f(t){var e=24==t.length?t.substring(0,22)+":"+t.substring(22,24):t;this.value=new Date(e)}function h(t){this.value=t}function p(t,e){this.main=t,this.views=e||{}}function m(t,e,n,r){this.url=t,this.width=e,this.height=n,this.alt=r}function d(e){this.value=[];for(var n=0;n<e.length;n++)this.value.push(new t.Prismic.GroupDoc(e[n]))}function g(t){this.blocks=t}function v(t){return t&&t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>")}function y(t,e,n,r){if(!e||!e.length)return v(t);var i={},o={};e.forEach(function(t){i[t.start]||(i[t.start]=[]),o[t.end]||(o[t.end]=[]),i[t.start].push(t),o[t.end].unshift(t)});for(var s,a="",u=[],l=0,c=t.length+1;c>l;l++)o[l]&&o[l].forEach(function(){var t=u.pop();if("undefined"!=typeof t){var e=T(t.span,t.text,r);0===u.length?a+=e:u[u.length-1].text+=e}}),i[l]&&(i[l].sort(function(t,e){return e.end-e.start-(t.end-t.start)}),i[l].forEach(function(t){var e=null;if("hyperlink"==t.type){var r=k(t.data);if(!r)return console&&console.error&&console.error("Impossible to convert span.data as a Fragment",t),"";e=r.url(n),t.url=e}var i={span:t,text:""};u.push(i)})),l<t.length&&(s=t[l],0===u.length?a+=v(s):u[u.length-1].text+=v(s));return a}function x(t,e,n){this.sliceType=t,this.label=e,this.value=n}function b(t){this.value=[];for(var e=0;e<t.length;e++){var n=t[e].slice_type,r=k(t[e].value),i=t[e].slice_label||null;n&&r&&this.value.push(new x(n,i,r))}}function k(t){var v={Color:a,Number:l,Date:c,Timestamp:f,Text:e,Embed:h,GeoPoint:u,Select:s,StructuredText:g,"Link.document":n,"Link.web":r,"Link.file":i,"Link.image":o,Group:d,SliceZone:b};if(v[t.type])return new v[t.type](t.value);if("Image"===t.type){var y=t.value.main,x=new p(new m(y.url,y.dimensions.width,y.dimensions.height,y.alt),{});for(var k in t.value.views)y=t.value.views[k],x.views[k]=new m(y.url,y.dimensions.width,y.dimensions.height,y.alt);return x}console&&console.log&&console.log("Fragment type not supported: ",t.type)}function w(t){var e={};return t&&"[object Function]"===e.toString.call(t)}function T(t,e,n){if(n){var r=n(t,e);if(r)return r}var i={heading1:"h1",heading2:"h2",heading3:"h3",heading4:"h4",heading5:"h5",heading6:"h6",paragraph:"p",preformatted:"pre","list-item":"li","o-list-item":"li","group-list-item":"ul","group-o-list-item":"ol",strong:"strong",em:"em"};if(i[t.type]){var o=i[t.type],s=t.label?' class="'+t.label+'"':"";return"<"+o+s+">"+e+"</"+o+">"}if("image"==t.type){var a=t.label?" "+t.label:"",u='<img src="'+t.url+'" alt="'+t.alt+'">';return'<p class="block-img'+a+'">'+(t.linkUrl?'<a href="'+t.linkUrl+'">'+u+"</a>":u)+"</p>"}return"embed"==t.type?'<div data-oembed="'+t.embed_url+'" data-oembed-type="'+t.type+'" data-oembed-provider="'+t.provider_name+(t.label?'" class="'+t.label:"")+'">'+t.oembed.html+"</div>":"hyperlink"===t.type?'<a href="'+t.url+'">'+e+"</a>":"label"===t.type?'<span class="'+t.data.label+'">'+e+"</span>":"<!-- Warning: "+t.type+" not implemented. Upgrade the Developer Kit. -->"+e}e.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},n.prototype=Object.create(t.Prismic.WithFragments.prototype),n.prototype.asHtml=function(t){return'<a href="'+this.url(t)+'">'+this.url(t)+"</a>"},n.prototype.url=function(t){return t(this,this.isBroken)},n.prototype.asText=function(t){return this.url(t)},r.prototype={asHtml:function(){return'<a href="'+this.url()+'">'+this.url()+"</a>"},url:function(){return this.value.url},asText:function(){return this.url()}},i.prototype={asHtml:function(){return'<a href="'+this.url()+'">'+this.value.file.name+"</a>"},url:function(){return this.value.file.url},asText:function(){return this.url()}},o.prototype={asHtml:function(){return'<a href="'+this.url()+'"><img src="'+this.url()+'" alt="'+this.alt+'"></a>'},url:function(){return this.value.image.url},asText:function(){return this.url()}},s.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},a.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},u.prototype={asHtml:function(){return'<div class="geopoint"><span class="latitude">'+this.latitude+'</span><span class="longitude">'+this.longitude+"</span></div>"},asText:function(){return"("+this.latitude+","+this.longitude+")"}},l.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value.toString()}},c.prototype={asHtml:function(){return"<time>"+this.value+"</time>"},asText:function(){return this.value.toString()}},f.prototype={asHtml:function(){return"<time>"+this.value+"</time>"},asText:function(){return this.value.toString()}},h.prototype={asHtml:function(){return this.value.oembed.html},asText:function(){return""}},p.prototype={getView:function(t){return"main"===t?this.main:this.views[t]},asHtml:function(){return this.main.asHtml()},asText:function(){return""}},m.prototype={ratio:function(){return this.width/this.height},asHtml:function(){return'<img src="'+this.url+'" width="'+this.width+'" height="'+this.height+'" alt="'+this.alt+'">'},asText:function(){return""}},d.prototype={asHtml:function(t){for(var e="",n=0;n<this.value.length;n++)e+=this.value[n].asHtml(t);return e},toArray:function(){return this.value},asText:function(t){for(var e="",n=0;n<this.value.length;n++)e+=this.value[n].asText(t)+"\n";return e}},g.prototype={getTitle:function(){for(var t=0;t<this.blocks.length;t++){var e=this.blocks[t];if(0===e.type.indexOf("heading"))return e}},getFirstParagraph:function(){for(var t=0;t<this.blocks.length;t++){var e=this.blocks[t];if("paragraph"==e.type)return e}},getParagraphs:function(){for(var t=[],e=0;e<this.blocks.length;e++){var n=this.blocks[e];"paragraph"==n.type&&t.push(n)}return t},getParagraph:function(t){return this.getParagraphs()[t]},getFirstImage:function(){for(var t=0;t<this.blocks.length;t++){var e=this.blocks[t];if("image"==e.type)return new m(e.url,e.dimensions.width,e.dimensions.height,e.alt)}},asHtml:function(t,e){var n,r,i=[],o=[];if(!w(t)){var s=t;t=function(t,e){return s.linkResolver(s,t,e)}}if(Array.isArray(this.blocks)){for(var a=0;a<this.blocks.length;a++){if(r=this.blocks[a],"image"==r.type&&r.linkTo){var u=k(r.linkTo);r.linkUrl=u.url(t)}"list-item"!==r.type&&"o-list-item"!==r.type?(i.push(r),n=null):n&&n.type=="group-"+r.type?n.blocks.push(r):(n={type:"group-"+r.type,blocks:[r]},i.push(n))}var l=function(n){var r="";return n.blocks?n.blocks.forEach(function(t){r+=T(t,l(t),e)}):r=y(n.text,n.spans,t,e),r};i.forEach(function(t){o.push(T(t,l(t),e))})}return o.join("")},asText:function(){for(var t=[],e=0;e<this.blocks.length;e++){var n=this.blocks[e];n.text&&t.push(n.text)}return t.join(" ")}},x.prototype={asHtml:function(t){return this.value.asHtml(t)},asText:function(){return this.value.asText()}},b.prototype={asHtml:function(t){for(var e="",n=0;n<this.value.length;n++)e+=this.value[n].asHtml(t);return e},asText:function(){for(var t="",e=0;e<this.value.length;e++)t+=this.value[e].asText()+"\n";return t}},t.Prismic.Fragments={Image:p,ImageView:m,Text:e,Number:l,Date:c,Timestamp:f,Select:s,Color:a,StructuredText:g,WebLink:r,DocumentLink:n,ImageLink:o,FileLink:i,Group:d,GeoPoint:u,Slice:x,SliceZone:b,initField:k,insertSpans:y}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";var e={at:function(t,e){return["at",t,e]},any:function(t,e){return["any",t,e]},fulltext:function(t,e){return["fulltext",t,e]},similar:function(t,e){return["similar",t,e]},gt:function(t,e){return["number.gt",t,e]},lt:function(t,e){return["number.lt",t,e]},inRange:function(t,e,n){return["number.inRange",t,e,n]},dateBefore:function(t,e){return["date.before",t,e]},dateAfter:function(t,e){return["date.after",t,e]},dateBetween:function(t,e,n){return["date.between",t,e,n]},dayOfMonth:function(t,e){return["date.day-of-month",t,e]},dayOfMonthAfter:function(t,e){return["date.day-of-month-after",t,e]},dayOfMonthBefore:function(t,e){return["date.day-of-month-before",t,e]},dayOfWeek:function(t,e){return["date.day-of-week",t,e]},dayOfWeekAfter:function(t,e){return["date.day-of-week-after",t,e]},dayOfWeekBefore:function(t,e){return["date.day-of-week-before",t,e]},month:function(t,e){return["date.month",t,e]},monthBefore:function(t,e){return["date.month-before",t,e]},monthAfter:function(t,e){return["date.month-after",t,e]},year:function(t,e){return["date.year",t,e]},hour:function(t,e){return["date.hour",t,e]},hourBefore:function(t,e){return["date.hour-before",t,e]},hourAfter:function(t,e){return["date.hour-after",t,e]},near:function(t,e,n,r){return["geopoint.near",t,e,n,r]}};t.Prismic.Predicates=e}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";function e(t){var e=[],r=[];t&&(t.drafts&&t.drafts.forEach(function(t){e.push(new n(t))}),t.running&&t.running.forEach(function(t){r.push(new n(t))})),this.drafts=e,this.running=r}function n(t){this.data=t;var e=[];t.variations&&t.variations.forEach(function(t){e.push(new r(t))}),this.variations=e}function r(t){this.data=t}e.prototype.current=function(){return this.running.length>0?this.running[0]:null},e.prototype.refFromCookie=function(t){if(!t||""===t.trim())return null;var e=t.trim().split(" ");if(e.length<2)return null;var n=e[0],r=parseInt(e[1],10),i=this.running.filter(function(t){return t.googleId()==n&&t.variations.length>r})[0];return i?i.variations[r].ref():null},n.prototype.id=function(){return this.data.id},n.prototype.googleId=function(){return this.data.googleId},n.prototype.name=function(){return this.data.name},r.prototype.id=function(){return this.data.id},r.prototype.ref=function(){return this.data.ref},r.prototype.label=function(){return this.data.label},t.Prismic.Experiments=e,t.Prismic.Experiment=n,t.Prismic.Variation=r}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){t.Prismic.version="1.1.7"}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window);
!function(){"function"!=typeof Object.create&&(Object.create=function(){var t=function(){};return function(e){if(arguments.length>1)throw Error("Second argument not supported");if("object"!=typeof e)throw TypeError("Argument must be an object");t.prototype=e;var n={};return t.prototype=null,n}}())}(),function(t,e){"use strict";function n(t,e,n,r,i,o){this.name=t,this.fields=e,this.form_method=n,this.rel=r,this.enctype=i,this.action=o}function r(t,e,n){this.api=t,this.form=e,this.data=n||{};for(var r in e.fields)e.fields[r]["default"]&&(this.data[r]=[e.fields[r]["default"]])}function i(t,e,n,r,i,o,s,a){this.page=t,this.results_per_page=e,this.results_size=n,this.total_results_size=r,this.total_pages=i,this.next_page=o,this.prev_page=s,this.results=a}function o(t,e,n,r,i){this.ref=t,this.label=e,this.isMaster=n,this.scheduledAt=r,this.id=i}function s(){var e;return e="object"==typeof global?global:window,e.prismicCache||(e.prismicCache=new t.Prismic.ApiCache),e.prismicCache}var a=function(e,n,r,i,o,s){var u=new a.fn.init(e,r,i,o,s);return u.get(function(e,r){return n&&e?n(e):(r&&(u.data=r,u.bookmarks=r.bookmarks,u.experiments=new t.Prismic.Experiments(r.experiments)),n?n(null,u):void 0)}),u};a.fn=a.prototype={AT:"at",ANY:"any",SIMILAR:"similar",FULLTEXT:"fulltext",NUMBER:{GT:"number.gt",LT:"number.lt"},DATE:{AFTER:"date.after",BEFORE:"date.before",BETWEEN:"date.between"},DOCUMENT:{ID:"document.id",TYPE:"document.type",TAGS:"document.tags"},constructor:a,data:null,get:function(t){var e=this,n=this.apiCacheKey;this.apiCache.get(n,function(r,i){return r?t(r):i?t(null,i):void e.requestHandler(e.url,function(r,i,o,s){if(r)return t(r,null,o);var a=e.parse(i);s|=e.apiDataTTL,e.apiCache.set(n,a,s,function(e){return e?t(e,null,o):t(null,a,o)})})})},refresh:function(e){var n=this,r=this.apiCacheKey;this.apiCache.remove(r,function(r){if(e&&r)return e(r);if(!e&&r)throw r;n.get(function(r,i){if(e&&r)return e(r);if(!e&&r)throw r;return n.data=i,n.bookmarks=i.bookmarks,n.experiments=new t.Prismic.Experiments(i.experiments),e?e():void 0})})},parse:function(t){var e,r,i,s,a,u,l,c={};for(l in t.forms)t.forms.hasOwnProperty(l)&&(u=t.forms[l],this.accessToken&&(u.fields.access_token={},u.fields.access_token.type="string",u.fields.access_token["default"]=this.accessToken),i=new n(u.name,u.fields,u.form_method,u.rel,u.enctype,u.action),c[l]=i);if(e=t.refs.map(function(t){return new o(t.ref,t.label,t.isMasterRef,t.scheduledAt,t.id)})||[],r=e.filter(function(t){return t.isMaster===!0}),s=t.types,a=t.tags,0===r.length)throw"No master ref.";return{bookmarks:t.bookmarks||{},refs:e,forms:c,master:r[0],types:s,tags:a,experiments:t.experiments,oauthInitiate:t.oauth_initiate,oauthToken:t.oauth_token}},init:function(e,n,r,i,o){return this.url=e+(n?(e.indexOf("?")>-1?"&":"?")+"access_token="+n:""),this.accessToken=n,this.apiCache=i||s(),this.requestHandler=r||t.Prismic.Utils.request(),this.apiCacheKey=this.url+(this.accessToken?"#"+this.accessToken:""),this.apiDataTTL=o||5,this},forms:function(t){return this.form(t)},form:function(t){var e=this.data.forms[t];return e?new r(this,e,{}):void 0},master:function(){return this.data.master.ref},ref:function(t){for(var e=0;e<this.data.refs.length;e++)if(this.data.refs[e].label==t)return this.data.refs[e].ref},currentExperiment:function(){return this.experiments.current()},parseDoc:function(n){var r={};for(var i in n.data[n.type])r[n.type+"."+i]=n.data[n.type][i];var o=[];if(n.slugs!==e)for(var s=0;s<n.slugs.length;s++)o.push(decodeURIComponent(n.slugs[s]));return new t.Prismic.Document(n.id,n.uid||null,n.type,n.href,n.tags,o,r)},previewSession:function(e,n,r,i){var o=this,s=t.Prismic.Predicates;this.requestHandler(e,function(t,a,u){if(t)return console.log("Error from the request"),void i(t,r,u);try{var l=a.mainDocument;l?o.form("everything").query(s.at("document.id",l)).ref(e).submit(function(t,e){t&&i(t);try{0===e.results.length?i(null,r,u):i(null,n(e.results[0]),u)}catch(o){i(o)}}):i(null,r,u)}catch(c){console.log("Caught e ",c),i(c,r,u)}})},request:function(t,e){var n=this,r=t+(this.accessToken?"#"+this.accessToken:""),o=this.apiCache;o.get(r,function(s,u){return s?e(s):u?e(null,u):void n.requestHandler(t,function(t,n,s,u){if(t)return void e(t,null,s);var l=n.results.map(a.fn.parseDoc),c=new i(n.page,n.results_per_page,n.results_size,n.total_results_size,n.total_pages,n.next_page,n.prev_page,l||[]);return u?void o.set(r,c,u,function(t){return t?e(t):e(null,c)}):e(null,c)})})}},a.fn.init.prototype=a.fn,n.prototype={},r.prototype={set:function(t,n){var r=this.form.fields[t];if(!r)throw new Error("Unknown field "+t);var i=this.data[t]||[];return(""===n||n===e)&&(n=null),r.multiple?n&&i.push(n):i=n&&[n],this.data[t]=i,this},ref:function(t){return this.set("ref",t)},query:function(t){if("string"==typeof t)return this.set("q",t);var e=[].slice.apply(arguments),n=[];return e.forEach(function(t){var e=0===t[1].indexOf("my.")||0===t[1].indexOf("document")?t[1]:'"'+t[1]+'"';n.push("[:d = "+t[0]+"("+e+(t.length>2?", ":"")+function(){return t.slice(2).map(function(t){return"string"==typeof t?'"'+t+'"':Array.isArray(t)?"["+t.map(function(t){return'"'+t+'"'}).join(",")+"]":t instanceof Date?t.getTime():t}).join(",")}()+")]")}),this.query("["+n.join("")+"]")},pageSize:function(t){return this.set("pageSize",t)},fetch:function(t){return t instanceof Array&&(t=t.join(",")),this.set("fetch",t)},fetchLinks:function(t){return t instanceof Array&&(t=t.join(",")),this.set("fetchLinks",t)},page:function(t){return this.set("page",t)},orderings:function(t){return"string"==typeof t?this.set("orderings",t):t?this.set("orderings","["+t.join(",")+"]"):this},submit:function(t){var e=this.form.action;if(this.data){var n=e.indexOf("?")>-1?"&":"?";for(var r in this.data)if(this.data.hasOwnProperty(r)){var i=this.data[r];if(i)for(var o=0;o<i.length;o++)e+=n+r+"="+encodeURIComponent(i[o]),n="&"}}this.api.request(e,t)}},o.prototype={},t.Prismic={experimentCookie:"io.prismic.experiment",previewCookie:"io.prismic.preview",Api:a}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t,e){function n(t){this.size=0,this.limit=t,this._keymap={}}n.prototype.put=function(t,e){var n={key:t,value:e};return this._keymap[t]=n,this.tail?(this.tail.newer=n,n.older=this.tail):this.head=n,this.tail=n,this.size===this.limit?this.shift():void this.size++},n.prototype.shift=function(){var t=this.head;return t&&(this.head.newer?(this.head=this.head.newer,this.head.older=e):this.head=e,t.newer=t.older=e,delete this._keymap[t.key]),t},n.prototype.get=function(t,n){var r=this._keymap[t];if(r!==e)return r===this.tail?n?r:r.value:(r.newer&&(r===this.head&&(this.head=r.newer),r.newer.older=r.older),r.older&&(r.older.newer=r.newer),r.newer=e,r.older=this.tail,this.tail&&(this.tail.newer=r),this.tail=r,n?r:r.value)},n.prototype.find=function(t){return this._keymap[t]},n.prototype.set=function(t,e){var n,r=this.get(t,!0);return r?(n=r.value,r.value=e):(n=this.put(t,e),n&&(n=n.value)),n},n.prototype.remove=function(t){var n=this._keymap[t];if(n)return delete this._keymap[n.key],n.newer&&n.older?(n.older.newer=n.newer,n.newer.older=n.older):n.newer?(n.newer.older=e,this.head=n.newer):n.older?(n.older.newer=e,this.tail=n.older):this.head=this.tail=e,this.size--,n.value},n.prototype.removeAll=function(){this.head=this.tail=e,this.size=0,this._keymap={}},n.prototype.keys="function"==typeof Object.keys?function(){return Object.keys(this._keymap)}:function(){var t=[];for(var e in this._keymap)t.push(e);return t},n.prototype.forEach=function(t,n,r){var i;if(n===!0?(r=!0,n=e):"object"!=typeof n&&(n=this),r)for(i=this.tail;i;)t.call(n,i.key,i.value,this),i=i.older;else for(i=this.head;i;)t.call(n,i.key,i.value,this),i=i.newer},n.prototype.toJSON=function(){for(var t=[],e=this.head;e;)t.push({key:e.key.toJSON(),value:e.value.toJSON()}),e=e.newer;return t},n.prototype.toString=function(){for(var t="",e=this.head;e;)t+=String(e.key)+":"+e.value,e=e.newer,e&&(t+=" < ");return t},t.Prismic.LRUCache=n}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";function e(e){this.lru=new t.Prismic.LRUCache(e)}e.prototype={get:function(t,e){var n=this.lru.get(t);return n&&!this.isExpired(t)?e(null,n.data):e()},set:function(t,e,n,r){return this.lru.remove(t),this.lru.put(t,{data:e,expiredIn:n?Date.now()+1e3*n:0}),r()},isExpired:function(t){var e=this.lru.get(t);return e?0!==e.expiredIn&&e.expiredIn<Date.now():!1},remove:function(t,e){return this.lru.remove(t),e()},clear:function(t){return this.lru.removeAll(),t()}},t.Prismic.ApiCache=e}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t,e){"use strict";var n=function(){return"undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest?function(t,e){var n=new XMLHttpRequest,r=function(){var t,r=/max-age\s*=\s*(\d+)/.exec(n.getResponseHeader("Cache-Control"));r&&r.length>1&&(t=parseInt(r[1],10)),e(null,JSON.parse(n.responseText),n,t)},i=function(){var r=n.status;e(new Error("Unexpected status code ["+r+"] on URL "+t),null,n)};n.onreadystatechange=function(){4===n.readyState&&(n.status&&200==n.status?r():i())},n.open("GET",t,!0),n.setRequestHeader("Accept","application/json"),n.send()}:void 0},r=function(){return"undefined"!=typeof XDomainRequest?function(t,e){var n=new XDomainRequest,r=function(){var t,r=/max-age\s*=\s*(\d+)/.exec(xhr.getResponseHeader("Cache-Control"));r&&r.length>1&&(t=parseInt(r[1],10)),e(null,JSON.parse(n.responseText),n,t)},i=function(t){e(new Error(t),null,n)};n.onload=function(){r(n)},n.onerror=function(){i("Unexpected status code on URL "+t)},n.open("GET",t,!0),n.ontimeout=function(){i("Request timeout")},n.onprogress=function(){},n.send()}:void 0},i=function(){if("function"==typeof require&&require("http")){var t=require("http"),n=require("https"),r=require("url"),i=(require("querystring"),require("../package.json"));return function(o,s){var a=r.parse(o),u="https:"==a.protocol?n:t,l={hostname:a.hostname,path:a.path,query:a.query,headers:{Accept:"application/json","User-Agent":"Prismic-javascript-kit/"+i.version+" NodeJS/"+process.version}};u.get(l,function(t){if(t.statusCode&&200==t.statusCode){var n="";t.setEncoding("utf8"),t.on("data",function(t){n+=t}),t.on("end",function(){var r=JSON.parse(n),i=t.headers["cache-control"],o=i&&/max-age=(\d+)/.test(i)?parseInt(/max-age=(\d+)/.exec(i)[1],10):e;s(null,r,t,o)})}else s(new Error("Unexpected status code ["+t.statusCode+"] on URL "+o),null,t)})}}},o=0,s=[],a=function(){if(!(0===s.length||o>=t.Prismic.Utils.MAX_CONNECTIONS)){o++;var e=s.shift(),u=n()||r()||i()||function(){throw new Error("No request handler available (tried XMLHttpRequest & NodeJS)")}();u.call(this,e.url,function(t,n,r,i){o--,e.callback(t,n,r,i),a()})}},u=function(){return function(t,e){s.push({url:t,callback:e}),a()}};t.Prismic.Utils={MAX_CONNECTIONS:20,request:u}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";function e(){}function n(t,e,n,r,i,o,s){this.id=t,this.uid=e,this.type=n,this.href=r,this.tags=i,this.slug=o?o[0]:"-",this.slugs=o,this.fragments=s}function r(t){this.fragments=t}function i(t){var e={};return t&&"[object Function]"===e.toString.call(t)}e.prototype={get:function(e){var n=this._getFragments(e);return n.length?t.Prismic.Fragments.initField(n[0]):null},getAll:function(e){return this._getFragments(e).map(function(e){return t.Prismic.Fragments.initField(e)},this)},getImage:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Image?n:n instanceof t.Prismic.Fragments.StructuredText?n:null},getAllImages:function(e){var n=this.getAll(e);return n.map(function(e){if(e instanceof t.Prismic.Fragments.Image)return e;if(e instanceof t.Prismic.Fragments.StructuredText)throw new Error("Not done.");return null})},getImageView:function(e,n){var r=this.get(e);if(r instanceof t.Prismic.Fragments.Image)return r.getView(n);if(r instanceof t.Prismic.Fragments.StructuredText)for(var i=0;i<r.blocks.length;i++)if("image"==r.blocks[i].type)return r.blocks[i];return null},getAllImageViews:function(t,e){return this.getAllImages(t).map(function(t){return t.getView(e)})},getTimestamp:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Timestamp?n.value:void 0},getDate:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Date?n.value:void 0},getBoolean:function(t){var e=this.get(t);return e.value&&("yes"==e.value.toLowerCase()||"on"==e.value.toLowerCase()||"true"==e.value.toLowerCase())},getText:function(e,n){var r=this.get(e);return r instanceof t.Prismic.Fragments.StructuredText?r.blocks.map(function(t){return t.text?t.text+(n?n:""):void 0}).join("\n"):r instanceof t.Prismic.Fragments.Text&&r.value?r.value+(n?n:""):r instanceof t.Prismic.Fragments.Number&&r.value?r.value+(n?n:""):r instanceof t.Prismic.Fragments.Select&&r.value?r.value+(n?n:""):r instanceof t.Prismic.Fragments.Color&&r.value?r.value+(n?n:""):void 0},getStructuredText:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.StructuredText?n:null},getLink:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.WebLink||n instanceof t.Prismic.Fragments.DocumentLink||n instanceof t.Prismic.Fragments.ImageLink?n:null},getNumber:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Number?n.value:null},getColor:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Color?n.value:null},getGeoPoint:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.GeoPoint?n:null},getGroup:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.Group?n:null},getSliceZone:function(e){var n=this.get(e);return n instanceof t.Prismic.Fragments.SliceZone?n:null},getHtml:function(t,e){if(!i(e)){var n=e;e=function(t,e){return n.linkResolver(n,t,e)}}var r=this.get(t);return r&&r.asHtml?r.asHtml(e):null},asHtml:function(t){if(!i(t)){var e=t;t=function(t,n){return e.linkResolver(e,t,n)}}var n=[];for(var r in this.fragments){var o=this.get(r);n.push(o&&o.asHtml?'<section data-field="'+r+'">'+o.asHtml(t)+"</section>":"")}return n.join("")},asText:function(t){if(!i(t)){var e=t;t=function(t,n){return e.linkResolver(e,t,n)}}var n=[];for(var r in this.fragments){var o=this.get(r);n.push(o&&o.asText?o.asText(t):"")}return n.join("")},linkedDocuments:function(){var e,n,r,i=[];for(var o in this.fragments){var s=this.get(o);if(s instanceof t.Prismic.Fragments.DocumentLink&&i.push(s),s instanceof t.Prismic.Fragments.StructuredText)for(e=0;e<s.blocks.length;e++){var a=s.blocks[e];"image"==a.type&&a.linkTo&&(r=t.Prismic.Fragments.initField(a.linkTo),r instanceof DocumentLink&&i.push(r));var u=a.spans||[];for(n=0;n<u.length;n++){var l=u[n];"hyperlink"==l.type&&(r=t.Prismic.Fragments.initField(l.data),r instanceof t.Prismic.Fragments.DocumentLink&&i.push(r))}}if(s instanceof t.Prismic.Fragments.Group)for(e=0;e<s.value.length;e++)i=i.concat(s.value[e].linkedDocuments())}return i},_getFragments:function(t){return this.fragments&&this.fragments[t]?Array.isArray(this.fragments[t])?this.fragments[t]:[this.fragments[t]]:[]}},n.prototype=Object.create(e.prototype),r.prototype=Object.create(e.prototype),t.Prismic.WithFragments=e,t.Prismic.Document=n,t.Prismic.GroupDoc=r}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";function e(t){this.value=t}function n(t){this.value=t,this.document=t.document,this.id=t.document.id,this.uid=t.document.uid,this.tags=t.document.tags,this.slug=t.document.slug,this.type=t.document.type;var e={};if(t.document.data)for(var n in t.document.data[t.document.type])e[t.document.type+"."+n]=t.document.data[t.document.type][n];this.fragments=e,this.isBroken=t.isBroken}function r(t){this.value=t}function i(t){this.value=t}function o(t){this.value=t}function s(t){this.value=t}function a(t){this.value=t}function u(t){this.latitude=t.latitude,this.longitude=t.longitude}function l(t){this.value=t}function c(t){this.value=new Date(t)}function f(t){var e=24==t.length?t.substring(0,22)+":"+t.substring(22,24):t;this.value=new Date(e)}function h(t){this.value=t}function p(t,e){this.main=t,this.views=e||{}}function m(t,e,n,r){this.url=t,this.width=e,this.height=n,this.alt=r}function d(e){this.value=[];for(var n=0;n<e.length;n++)this.value.push(new t.Prismic.GroupDoc(e[n]))}function g(t){this.blocks=t}function v(t){return t&&t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br>")}function y(t,e,n,r){if(!e||!e.length)return v(t);var i={},o={};e.forEach(function(t){i[t.start]||(i[t.start]=[]),o[t.end]||(o[t.end]=[]),i[t.start].push(t),o[t.end].unshift(t)});for(var s,a="",u=[],l=0,c=t.length+1;c>l;l++)o[l]&&o[l].forEach(function(){var t=u.pop();if("undefined"!=typeof t){var e=T(t.span,t.text,r);0===u.length?a+=e:u[u.length-1].text+=e}}),i[l]&&(i[l].sort(function(t,e){return e.end-e.start-(t.end-t.start)}),i[l].forEach(function(t){var e=null;if("hyperlink"==t.type){var r=k(t.data);if(!r)return console&&console.error&&console.error("Impossible to convert span.data as a Fragment",t),"";e=r.url(n),t.url=e}var i={span:t,text:""};u.push(i)})),l<t.length&&(s=t[l],0===u.length?a+=v(s):u[u.length-1].text+=v(s));return a}function x(t,e,n){this.sliceType=t,this.label=e,this.value=n}function b(t){this.value=[];for(var e=0;e<t.length;e++){var n=t[e].slice_type,r=k(t[e].value),i=t[e].slice_label||null;n&&r&&this.value.push(new x(n,i,r))}}function k(t){var v={Color:a,Number:l,Date:c,Timestamp:f,Text:e,Embed:h,GeoPoint:u,Select:s,StructuredText:g,"Link.document":n,"Link.web":r,"Link.file":i,"Link.image":o,Group:d,SliceZone:b};if(v[t.type])return new v[t.type](t.value);if("Image"===t.type){var y=t.value.main,x=new p(new m(y.url,y.dimensions.width,y.dimensions.height,y.alt),{});for(var k in t.value.views)y=t.value.views[k],x.views[k]=new m(y.url,y.dimensions.width,y.dimensions.height,y.alt);return x}console&&console.log&&console.log("Fragment type not supported: ",t.type)}function w(t){var e={};return t&&"[object Function]"===e.toString.call(t)}function T(t,e,n){if(n){var r=n(t,e);if(r)return r}var i={heading1:"h1",heading2:"h2",heading3:"h3",heading4:"h4",heading5:"h5",heading6:"h6",paragraph:"p",preformatted:"pre","list-item":"li","o-list-item":"li","group-list-item":"ul","group-o-list-item":"ol",strong:"strong",em:"em"};if(i[t.type]){var o=i[t.type],s=t.label?' class="'+t.label+'"':"";return"<"+o+s+">"+e+"</"+o+">"}if("image"==t.type){var a=t.label?" "+t.label:"",u='<img src="'+t.url+'" alt="'+t.alt+'">';return'<p class="block-img'+a+'">'+(t.linkUrl?'<a href="'+t.linkUrl+'">'+u+"</a>":u)+"</p>"}return"embed"==t.type?'<div data-oembed="'+t.embed_url+'" data-oembed-type="'+t.type+'" data-oembed-provider="'+t.provider_name+(t.label?'" class="'+t.label:"")+'">'+t.oembed.html+"</div>":"hyperlink"===t.type?'<a href="'+t.url+'">'+e+"</a>":"label"===t.type?'<span class="'+t.data.label+'">'+e+"</span>":"<!-- Warning: "+t.type+" not implemented. Upgrade the Developer Kit. -->"+e}e.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},n.prototype=Object.create(t.Prismic.WithFragments.prototype),n.prototype.asHtml=function(t){return'<a href="'+this.url(t)+'">'+this.url(t)+"</a>"},n.prototype.url=function(t){return t(this,this.isBroken)},n.prototype.asText=function(t){return this.url(t)},r.prototype={asHtml:function(){return'<a href="'+this.url()+'">'+this.url()+"</a>"},url:function(){return this.value.url},asText:function(){return this.url()}},i.prototype={asHtml:function(){return'<a href="'+this.url()+'">'+this.value.file.name+"</a>"},url:function(){return this.value.file.url},asText:function(){return this.url()}},o.prototype={asHtml:function(){return'<a href="'+this.url()+'"><img src="'+this.url()+'" alt="'+this.alt+'"></a>'},url:function(){return this.value.image.url},asText:function(){return this.url()}},s.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},a.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value}},u.prototype={asHtml:function(){return'<div class="geopoint"><span class="latitude">'+this.latitude+'</span><span class="longitude">'+this.longitude+"</span></div>"},asText:function(){return"("+this.latitude+","+this.longitude+")"}},l.prototype={asHtml:function(){return"<span>"+this.value+"</span>"},asText:function(){return this.value.toString()}},c.prototype={asHtml:function(){return"<time>"+this.value+"</time>"},asText:function(){return this.value.toString()}},f.prototype={asHtml:function(){return"<time>"+this.value+"</time>"},asText:function(){return this.value.toString()}},h.prototype={asHtml:function(){return this.value.oembed.html},asText:function(){return""}},p.prototype={getView:function(t){return"main"===t?this.main:this.views[t]},asHtml:function(){return this.main.asHtml()},asText:function(){return""}},m.prototype={ratio:function(){return this.width/this.height},asHtml:function(){return'<img src="'+this.url+'" width="'+this.width+'" height="'+this.height+'" alt="'+this.alt+'">'},asText:function(){return""}},d.prototype={asHtml:function(t){for(var e="",n=0;n<this.value.length;n++)e+=this.value[n].asHtml(t);return e},toArray:function(){return this.value},asText:function(t){for(var e="",n=0;n<this.value.length;n++)e+=this.value[n].asText(t)+"\n";return e}},g.prototype={getTitle:function(){for(var t=0;t<this.blocks.length;t++){var e=this.blocks[t];if(0===e.type.indexOf("heading"))return e}},getFirstParagraph:function(){for(var t=0;t<this.blocks.length;t++){var e=this.blocks[t];if("paragraph"==e.type)return e}},getParagraphs:function(){for(var t=[],e=0;e<this.blocks.length;e++){var n=this.blocks[e];"paragraph"==n.type&&t.push(n)}return t},getParagraph:function(t){return this.getParagraphs()[t]},getFirstImage:function(){for(var t=0;t<this.blocks.length;t++){var e=this.blocks[t];if("image"==e.type)return new m(e.url,e.dimensions.width,e.dimensions.height,e.alt)}},asHtml:function(t,e){var n,r,i=[],o=[];if(!w(t)){var s=t;t=function(t,e){return s.linkResolver(s,t,e)}}if(Array.isArray(this.blocks)){for(var a=0;a<this.blocks.length;a++){if(r=this.blocks[a],"image"==r.type&&r.linkTo){var u=k(r.linkTo);r.linkUrl=u.url(t)}"list-item"!==r.type&&"o-list-item"!==r.type?(i.push(r),n=null):n&&n.type=="group-"+r.type?n.blocks.push(r):(n={type:"group-"+r.type,blocks:[r]},i.push(n))}var l=function(n){var r="";return n.blocks?n.blocks.forEach(function(t){r+=T(t,l(t),e)}):r=y(n.text,n.spans,t,e),r};i.forEach(function(t){o.push(T(t,l(t),e))})}return o.join("")},asText:function(){for(var t=[],e=0;e<this.blocks.length;e++){var n=this.blocks[e];n.text&&t.push(n.text)}return t.join(" ")}},x.prototype={asHtml:function(t){return this.value.asHtml(t)},asText:function(){return this.value.asText()}},b.prototype={asHtml:function(t){for(var e="",n=0;n<this.value.length;n++)e+=this.value[n].asHtml(t);return e},asText:function(){for(var t="",e=0;e<this.value.length;e++)t+=this.value[e].asText()+"\n";return t}},t.Prismic.Fragments={Image:p,ImageView:m,Text:e,Number:l,Date:c,Timestamp:f,Select:s,Color:a,StructuredText:g,WebLink:r,DocumentLink:n,ImageLink:o,FileLink:i,Group:d,GeoPoint:u,Slice:x,SliceZone:b,initField:k,insertSpans:y}}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";var e={at:function(t,e){return["at",t,e]},missing:function(t){return["missing",t]},has:function(t){return["has",t]},any:function(t,e){return["any",t,e]},fulltext:function(t,e){return["fulltext",t,e]},similar:function(t,e){return["similar",t,e]},gt:function(t,e){return["number.gt",t,e]},lt:function(t,e){return["number.lt",t,e]},inRange:function(t,e,n){return["number.inRange",t,e,n]},dateBefore:function(t,e){return["date.before",t,e]},dateAfter:function(t,e){return["date.after",t,e]},dateBetween:function(t,e,n){return["date.between",t,e,n]},dayOfMonth:function(t,e){return["date.day-of-month",t,e]},dayOfMonthAfter:function(t,e){return["date.day-of-month-after",t,e]},dayOfMonthBefore:function(t,e){return["date.day-of-month-before",t,e]},dayOfWeek:function(t,e){return["date.day-of-week",t,e]},dayOfWeekAfter:function(t,e){return["date.day-of-week-after",t,e]},dayOfWeekBefore:function(t,e){return["date.day-of-week-before",t,e]},month:function(t,e){return["date.month",t,e]},monthBefore:function(t,e){return["date.month-before",t,e]},monthAfter:function(t,e){return["date.month-after",t,e]},year:function(t,e){return["date.year",t,e]},hour:function(t,e){return["date.hour",t,e]},hourBefore:function(t,e){return["date.hour-before",t,e]},hourAfter:function(t,e){return["date.hour-after",t,e]},near:function(t,e,n,r){return["geopoint.near",t,e,n,r]}};t.Prismic.Predicates=e}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){"use strict";function e(t){var e=[],r=[];t&&(t.drafts&&t.drafts.forEach(function(t){e.push(new n(t))}),t.running&&t.running.forEach(function(t){r.push(new n(t))})),this.drafts=e,this.running=r}function n(t){this.data=t;var e=[];t.variations&&t.variations.forEach(function(t){e.push(new r(t))}),this.variations=e}function r(t){this.data=t}e.prototype.current=function(){return this.running.length>0?this.running[0]:null},e.prototype.refFromCookie=function(t){if(!t||""===t.trim())return null;var e=t.trim().split(" ");if(e.length<2)return null;var n=e[0],r=parseInt(e[1],10),i=this.running.filter(function(t){return t.googleId()==n&&t.variations.length>r})[0];return i?i.variations[r].ref():null},n.prototype.id=function(){return this.data.id},n.prototype.googleId=function(){return this.data.googleId},n.prototype.name=function(){return this.data.name},r.prototype.id=function(){return this.data.id},r.prototype.ref=function(){return this.data.ref},r.prototype.label=function(){return this.data.label},t.Prismic.Experiments=e,t.Prismic.Experiment=n,t.Prismic.Variation=r}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window),function(t){t.Prismic.version="1.1.8"}("object"==typeof exports&&exports?exports:"object"==typeof module&&module&&"object"==typeof module.exports?module.exports:window);

@@ -12,3 +12,3 @@ {

],
"version": "1.1.7",
"version": "1.1.8",
"devDependencies": {

@@ -15,0 +15,0 @@ "codeclimate-test-reporter": "~0.0.4",

@@ -79,3 +79,3 @@ ## JavaScript development kit for prismic.io

### Licence
### License

@@ -82,0 +82,0 @@ This software is licensed under the Apache 2 license, quoted below.

@@ -327,7 +327,14 @@ (function (Global, undefined) {

api.form("everything").query(Predicates.at("document.id", mainDocumentId)).ref(token).submit(function(err, response) {
if (response.results.length === 0) {
callback(null, defaultUrl, xhr);
} else {
callback(null, linkResolver(response.results[0]), xhr);
if (err) {
callback(err);
}
try {
if (response.results.length === 0) {
callback(null, defaultUrl, xhr);
} else {
callback(null, linkResolver(response.results[0]), xhr);
}
} catch (e) {
callback(e);
}
});

@@ -477,3 +484,5 @@ }

: '"' + predicate[1] + '"';
stringQueries.push("[:d = " + predicate[0] + "(" + firstArg + ", " + (function() {
stringQueries.push("[:d = " + predicate[0] + "(" + firstArg +
(predicate.length > 2 ? ", " : "") +
(function() {
return predicate.slice(2).map(function(p) {

@@ -480,0 +489,0 @@ if (typeof p === 'string') {

@@ -23,2 +23,20 @@ (function (Global, undefined) {

/**
* Build a "missing" predicate: documents where the requested field is empty
*
* @example Predicates.missing("my.blog-post.author")
* @param fragment {String}
* @returns {Array} an array corresponding to the predicate
*/
missing: function(fragment) { return ["missing", fragment]; },
/**
* Build a "has" predicate: documents where the requested field is defined
*
* @example Predicates.has("my.blog-post.author")
* @param fragment {String}
* @returns {Array} an array corresponding to the predicate
*/
has: function(fragment) { return ["has", fragment]; },
/**
* Build an "any" predicate: equality of a fragment to a value.

@@ -25,0 +43,0 @@ *

@@ -157,2 +157,6 @@ (function(Prismic) {

assert.deepEqual(any, ["any", "document.type", ["article", "blog-post"]]); // gisthide
// "missing" predicate: documents having a non-empty field
var missing = Prismic.Predicates.missing("my.article.author");
// "has" predicate: documents having a non-empty field
var has = Prismic.Predicates.has("my.article.author");

@@ -159,0 +163,0 @@ // "fulltext" predicate: fulltext search in a fragment.

@@ -293,3 +293,3 @@ (function(Prismic) {

}
assert.equal(documents.results.length, 0);
assert.equal(0, documents.results.length);
done();

@@ -300,2 +300,18 @@ });

it('"has" predicates', function (done) {
Prismic.Api(microRepository, function (err, Api) {
if (err) throw err;
Api.form('everything').ref(Api.master()).query(
Predicates.has("my.doc.title")
).submit(function (err, documents) {
if (err) {
console.log(err);
return;
}
assert.equal(0, documents.results.length);
done();
});
});
});
it('Multiple predicates', function (done) {

@@ -302,0 +318,0 @@ Prismic.Api(microRepository, function (err, Api) {

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc