-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathng-hyper.min.js
1 lines (1 loc) · 26.7 KB
/
ng-hyper.min.js
1
!function(){function e(r){var t=e.modules[r];if(!t)throw new Error('failed to require "'+r+'"');return"exports"in t||"function"!=typeof t.definition||(t.client=t.component=!0,t.definition.call(this,t.exports={},t),delete t.definition),t.exports}e.modules={},e.register=function(r,t){e.modules[r]={definition:t}},e.define=function(r,t){e.modules[r]={exports:t}},e.register("[email protected]",function(e,r){function t(e){e=e.replace(/\r\n/g,"\n");for(var r="",t=0;t<e.length;t++){var n=e.charCodeAt(t);128>n?r+=String.fromCharCode(n):n>127&&2048>n?(r+=String.fromCharCode(n>>6|192),r+=String.fromCharCode(63&n|128)):(r+=String.fromCharCode(n>>12|224),r+=String.fromCharCode(n>>6&63|128),r+=String.fromCharCode(63&n|128))}return r}r.exports=t}),e.register("[email protected]",function(r,t){function n(e){var r,t,n,a,s,c,u,p="",h=0;for(e=i(e);h<e.length;)r=e.charCodeAt(h++),t=e.charCodeAt(h++),n=e.charCodeAt(h++),a=r>>2,s=(3&r)<<4|t>>4,c=(15&t)<<2|n>>6,u=63&n,isNaN(t)?c=u=64:isNaN(n)&&(u=64),p=p+o.charAt(a)+o.charAt(s)+o.charAt(c)+o.charAt(u);return p}var i=e("[email protected]"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.exports=n}),e.register("[email protected]",function(e,r){function t(e){var r,t,n,i,o="",a=0;for(r=t=n=0;a<e.length;)r=e.charCodeAt(a),128>r?(o+=String.fromCharCode(r),a++):r>191&&224>r?(n=e.charCodeAt(a+1),o+=String.fromCharCode((31&r)<<6|63&n),a+=2):(n=e.charCodeAt(a+1),i=e.charCodeAt(a+2),o+=String.fromCharCode((15&r)<<12|(63&n)<<6|63&i),a+=3);return o}r.exports=t}),e.register("[email protected]",function(r,t){function n(e){var r,t,n,a,s,c,u,p="",h=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");h<e.length;)a=o.indexOf(e.charAt(h++)),s=o.indexOf(e.charAt(h++)),c=o.indexOf(e.charAt(h++)),u=o.indexOf(e.charAt(h++)),r=a<<2|s>>4,t=(15&s)<<4|c>>2,n=(3&c)<<6|u,p+=String.fromCharCode(r),64!=c&&(p+=String.fromCharCode(t)),64!=u&&(p+=String.fromCharCode(n));return p=i(p)}var i=e("[email protected]"),o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";t.exports=n}),e.register("component~pad@master",function(e,r){function t(e,r,t){if(t=t||" ",e.length>=r)return e;r-=e.length;var n=Array(Math.ceil(r/2)+1).join(t),i=Array(Math.floor(r/2)+1).join(t);return n+e+i}e=r.exports=t,e.left=function(e,r,t){return t=t||" ",e.length>=r?e:Array(r-e.length+1).join(t)+e},e.right=function(e,r,t){return t=t||" ",e.length>=r?e:e+Array(r-e.length+1).join(t)}}),e.register("camshaft~websafe-base64@master",function(r){function t(e){var r=e.length%4;if(!r)return e;var t=4-r;return o(e,t,"=")}var n=e("[email protected]"),i=e("[email protected]"),o=e("component~pad@master");r.encode=function(e){return e?i(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"):""},r.decode=function(e){return e?n(t(e).replace(/\-/,"+").replace(/_/,"/")).replace(/\0/g,""):""}}),e.register("[email protected]",function(e,r){function t(e){return e?n(e):void 0}function n(e){for(var r in t.prototype)e[r]=t.prototype[r];return e}r.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,r){return this._callbacks=this._callbacks||{},(this._callbacks[e]=this._callbacks[e]||[]).push(r),this},t.prototype.once=function(e,r){function t(){n.off(e,t),r.apply(this,arguments)}var n=this;return this._callbacks=this._callbacks||{},t.fn=r,this.on(e,t),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,r){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var t=this._callbacks[e];if(!t)return this;if(1==arguments.length)return delete this._callbacks[e],this;for(var n,i=0;i<t.length;i++)if(n=t[i],n===r||n.fn===r){t.splice(i,1);break}return this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};var r=[].slice.call(arguments,1),t=this._callbacks[e];if(t){t=t.slice(0);for(var n=0,i=t.length;i>n;++n)t[n].apply(this,r)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}),e.register("[email protected]",function(e,r){function t(e){return e.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(a,"").match(/[$a-zA-Z_]\w*/g)||[]}function n(e,r,t){var n=/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g;return e.replace(n,function(e){return"("==e[e.length-1]?t(e):~r.indexOf(e)?t(e):e})}function i(e){for(var r=[],t=0;t<e.length;t++)~r.indexOf(e[t])||r.push(e[t]);return r}function o(e){return function(r){return e+r}}var a=/\b(this|Array|Date|Object|Math|JSON)\b/g;r.exports=function(e,r){var a=i(t(e));return r&&"string"==typeof r&&(r=o(r)),r?n(e,a,r):a}}),e.register("[email protected]",function(r,t){function n(e){switch({}.toString.call(e)){case"[object Object]":return s(e);case"[object Function]":return e;case"[object String]":return a(e);case"[object RegExp]":return o(e);default:return i(e)}}function i(e){return function(r){return e===r}}function o(e){return function(r){return e.test(r)}}function a(e){return/^ *\W+/.test(e)?new Function("_","return _ "+e):new Function("_","return "+c(e))}function s(e){var r={};for(var t in e)r[t]="string"==typeof e[t]?i(e[t]):n(e[t]);return function(e){if("object"!=typeof e)return!1;for(var t in r){if(!(t in e))return!1;if(!r[t](e[t]))return!1}return!0}}function c(e){var r=p(e);if(!r.length)return"_."+e;var t,n,i;for(n=0;n<r.length;n++)i=r[n],t="_."+i,t="('function' == typeof "+t+" ? "+t+"() : "+t+")",e=u(i,e,t);return e}function u(e,r,t){return r.replace(new RegExp("(\\.)?"+e,"g"),function(e,r){return r?e:t})}var p;try{p=e("[email protected]")}catch(h){p=e("[email protected]")}t.exports=n}),e.register("[email protected]",function(r,t){var n=e("[email protected]");t.exports=function(e,r){var t=[];r=n(r);for(var i=0;i<e.length;++i)t.push(r(e[i],i));return t}}),e.register("[email protected]",function(e,r){function t(e){return e.trim?e.trim():e.replace(/^\s*|\s*$/g,"")}e=r.exports=t,e.left=function(e){return e.trimLeft?e.trimLeft():e.replace(/^\s*/,"")},e.right=function(e){return e.trimRight?e.trimRight():e.replace(/\s*$/,"")}}),e.register("[email protected]",function(e,r){var t=Object.prototype.toString;r.exports=function(e){switch(t.call(e)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}return null===e?"null":void 0===e?"undefined":e&&1===e.nodeType?"element":e===Object(e)?"object":typeof e}}),e.register("[email protected]",function(r){var t=encodeURIComponent,n=decodeURIComponent,i=e("[email protected]"),o=e("[email protected]");r.parse=function(e){if("string"!=typeof e)return{};if(e=i(e),""==e)return{};"?"==e.charAt(0)&&(e=e.slice(1));for(var r={},t=e.split("&"),o=0;o<t.length;o++){var a,s=t[o].split("="),c=n(s[0]);(a=/(\w+)\[(\d+)\]/.exec(c))?(r[a[1]]=r[a[1]]||[],r[a[1]][a[2]]=n(s[1])):r[s[0]]=null==s[1]?"":n(s[1])}return r},r.stringify=function(e){if(!e)return"";var r=[];for(var n in e){var i=e[n];if("array"!=o(i))r.push(t(n)+"="+t(e[n]));else for(var a=0;a<i.length;++a)r.push(t(n+"["+a+"]")+"="+t(i[a]))}return r.join("&")}}),e.register("[email protected]",function(e){function r(e){switch(e){case"http:":return 80;case"https:":return 443;default:return location.port}}e.parse=function(e){var t=document.createElement("a");return t.href=e,{href:t.href,host:t.host||location.host,port:"0"===t.port||""===t.port?r(t.protocol):t.port,hash:t.hash,hostname:t.hostname||location.hostname,pathname:"/"!=t.pathname.charAt(0)?"/"+t.pathname:t.pathname,protocol:t.protocol&&":"!=t.protocol?t.protocol:location.protocol,search:t.search,query:t.search.slice(1)}},e.isAbsolute=function(e){return 0==e.indexOf("//")||!!~e.indexOf("://")},e.isRelative=function(r){return!e.isAbsolute(r)},e.isCrossDomain=function(r){r=e.parse(r);var t=e.parse(window.location.href);return r.hostname!==t.hostname||r.port!==t.port||r.protocol!==t.protocol}}),e.register("[email protected]",function(e,r){function t(){}function n(e,r,t){if(!(this instanceof n))return new n(e,r);if(this.client=r,!this.client)throw new Error("hyper-path requires a client to be passed as the second argument");this.delim=t||".",this.parse(e),this._listeners={},this._scope={},this._warnings={}}function i(e){return"undefined"!=typeof e&&null!==e}r.exports=n,n.prototype.scope=function(e){return this.trace("scope",arguments),this._scope=this.wrappedScope?[e]:e,this._fn&&this.get(),this},n.prototype.on=function(e){return this.trace("on",arguments),this._fn=e,this.get(),this},n.prototype.get=n.prototype.refresh=function(e){this.trace("get",arguments);var r=this._scope;return e=e||this._fn,this.off(),this.isRoot?this.fetchRoot(r,e):this.traverse(r,{},0,this.path,{},!0,e)},n.prototype.warn=function(e){return this._warnings[e]?void 0:(console.warn(e),this._warnings[e]=!0,this)},n.prototype.trace=function(){},n.prototype.parse=function(e){this.trace("parse",arguments);var r=this.path=Array.isArray(e)?e.slice():e.split(this.delim);this.index=r[0],1===r.length&&(this.wrappedScope=!0,r.unshift(0)),this.isRoot=""===this.index,this.target=r[r.length-1]},n.prototype.off=function(){this.trace("trace");for(var e in this._listeners)this.replaceListener(e,null,this._fn);return this},n.prototype.traverse=function(e,r,t,n,o,a,s){var c=this;if(c.trace("traverse",arguments),t>=n.length)return s(null,a?c._normalizeTarget(e):e,o);var u=n[t],p=c._get(u,e,r);if(!i(p))return c.handleUndefined(u,e,r,t,n,o,a,s);var h=t+1,f=n[h],l=c._get("href",p);return!l||p.hasOwnProperty(f)?c.traverse(p,r,h,n,o,a,s):c.fetchResource(l,h,n,a,s)},n.prototype.handleUndefined=function(e,r,t,n,i,o,a,s){this.trace("handleUndefined",arguments);var c=this._normalizeTarget(r);if(this._get(e,c))return this.traverse(c,t,n,i,o,a,s);var u=r&&r[e];return"function"==typeof u&&(u=void 0),s(null,u,o)},n.prototype.fetchRoot=function(e,r){var t=this;t.trace("fetchRoot",arguments);var n=t.client.root(function(n,i,o,a){if(n)return r(n);if(!i&&!o)return r(null);o=o||{};var s=t._get("href",i);return a=a||s,a?i=t._resolve(s,i):t.warn("root missing href: local JSON pointers will not function properly"),t.traverse(i||e,o,1,t.path,i,!0,r)});return t.replaceListener(".",n,r)},n.prototype.fetchResource=function(e,r,t,n,i){var o=this;o.trace("fetchResource",arguments);var a=e,s=a.split("#");if(e=s[0],""===e)return i(new Error('cannot request "'+a+'" without parent document'));var c=o.client.get(e,function(a,c,u,p){if(a)return i(a);if(!c&&!u)return i(null);u=u||{},e=p||e;var h=o._get("href",c);h||(c=o._set("href",e,c));var f=o._resolve(h||e,c);return 1===s.length?o.traverse(f,u,r,t,f,n,i):o.fetchJsonPath(f,u,s[1],r,t,n,i)});return o.replaceListener(a,c,i)},n.prototype.replaceListener=function(e,r,n){return this.trace("replaceListener",arguments),this._fn!==n?r:((this._listeners[e]||t)(),r?this._listeners[e]="function"==typeof r?r:t:delete this._listeners[e],r)},n.prototype.fetchJsonPath=function(e,r,t,n,i,o,a){var s=this;s.trace("fetchJsonPath",arguments);var c=t.split("/"),u=e.href+"#"+t;return""===c[0]&&c.shift(),s.traverse(e,r,0,c,e,!1,function(t,c){return t?a(t):(s._get("href",c)||(c=s._set("href",u,c)),s.traverse(c,r,n,i,e,o,a))})},n.prototype._resolve=function(e,r,t){if(this.trace("_resolve",arguments),!r||"object"!==(t||typeof r))return r;var n,i,o=Array.isArray(r)?[]:{};for(var a in r)r.hasOwnProperty(a)&&(n=r[a],i=typeof n,"href"===a&&"string"===i&&"#"===n.charAt(0)?o.href=e+n:o[a]=this._resolve(e,n,i));return o},n.prototype._get=function(e,r,t){return this.trace("_get",arguments),r?r.hasOwnProperty(e)?r[e]:"function"==typeof r.get?r.get(e):t&&t.hasOwnProperty(e)?{href:t[e]}:void 0:void 0},n.prototype._set=function(e,r,t){return this.trace("_set",arguments),t&&"object"==typeof t?"function"==typeof t.set?t.set(e,r):(t[e]=r,t):t},n.prototype._normalizeTarget=function(e){if(this.trace("_normalizeTarget",arguments),"object"!=typeof e||!e)return e;var r=this._get("href",e);return e=this._get("collection",e)||this._get("data",e)||e,r?this._set("href",r,e):e}}),e.register("[email protected]",function(e,r){r.exports=function(e,r){return r||(r={}),e.toLowerCase().replace(r.replace||/[^a-z0-9]/g," ").replace(/^ +| +$/g,"").replace(/ +/g,r.separator||"-")}}),e.register("[email protected]",function(e,r){r.exports=function(e,r,t){for(var n=0,i=e.length,o=3==arguments.length?t:e[n++];i>n;)o=r.call(null,o,e[n],++n,e);return o}}),e.register("[email protected]",function(r,t){function n(e,r){return o(e,function(e,r){var t=r.split(/ *= */),n=i(t[0]);return e[n]=i(t[1]),e},r)}function i(e){return e.replace(/^"/,"").replace(/"$/,"")}var o=e("[email protected]");t.exports=function(e,r){return o(e.split(/ *, */),function(e,t){var i=t.split(/ *; */),a=i[0].slice(1,-1),s=n(i.slice(1),{uri:a}),c=s.rel;if(!c)return e;var u=r?s:a;return o(c.split(/ +/),function(e,r){if(""===r)return e;switch(typeof e[r]){case"undefined":e[r]=u;break;case"string":e[r]=[e[r],u];break;default:e[r].push(u)}return e},e)},{})}}),e.register("ng-hyper",function(r,t){r=t.exports=e("ng-hyper/package.js"),r.controller=e("ng-hyper/controllers/hyper.js"),r.hyper=e("ng-hyper/directives/hyper.js"),r.hyperBind=e("ng-hyper/directives/hyper-bind.js"),r.hyperForm=e("ng-hyper/directives/hyper-form.js"),r.hyperImg=e("ng-hyper/directives/hyper-img.js"),r.hyperImgBackground=e("ng-hyper/directives/hyper-img-background.js"),r.hyperInput=e("ng-hyper/directives/hyper-input.js"),r.hyperInputOptions=e("ng-hyper/directives/hyper-input-options.js"),r.hyperLink=e("ng-hyper/directives/hyper-link.js"),r.hyperRedirect=e("ng-hyper/directives/hyper-redirect.js"),r.hyperService=e("ng-hyper/services/hyper.js"),r.hyperPathService=e("ng-hyper/services/hyper-path.js"),r.hyperStatusService=e("ng-hyper/services/hyper-status.js"),r.hyperLinkService=e("ng-hyper/services/hyper-link.js"),r.hyperLinkFormatterService=e("ng-hyper/services/hyper-link-formatter.js"),r.hyperBackendHTTPService=e("ng-hyper/services/hyper-backend-http.js"),r.name="ng-hyper"}),e.register("ng-hyper/package.js",function(r,t){var n=window.angular||e("angular");t.exports=n.module("ng-hyper",[])}),e.register("ng-hyper/controllers/hyper.js",function(){{var r=e("ng-hyper/package.js"),t=angular.forEach,n=e("ng-hyper/lib/utils.js"),i=(n.$safeApply,n.merge);e("[email protected]").isCrossDomain}r.controller("HyperController",["$scope","$routeParams","hyper","hyperLinkFormatter",function(e,r,n,o){var a={};e.$watch(function(){return r},function(s,c){t(c,function(t,n){r[n]!=t&&(a[n]&&a[n].$destroy(),delete e[n],delete a[n])}),t(r,function(r,t){if("slug"!==t){var s=o.decode(r);if(s&&(0===s.indexOf("http")||0===s.indexOf("/"))){var c=a[t]=e.$new(!0);c.value={href:s},n.get("value",c,function(r){e[t]=i(e[t],r)})}}})},!0)}])}),e.register("ng-hyper/directives/hyper-bind.js",function(){var r=e("ng-hyper/package.js");r.directive("hyperBind",["hyper","hyperStatus",function(e,r){function t(e){return"undefined"==typeof e?"":e}return{scope:!0,restrict:"A",link:function(n,i,o){r.loading(i),e.get(o.hyperBind,n,function(e,o){return n[o.target]=e,i.text(t(e)),r.isLoaded(e)?r.loaded(i):r.undef(i)})}}}])}),e.register("ng-hyper/directives/hyper-form.js",function(){function r(e,r){return e.$setPristine?e.$setPristine():(e.$pristine=!0,e.$dirty=!1,r.addClass("ng-pristine"),r.removeClass("ng-dirty"),void c(e,function(e,r){e&&"$"!==r.charAt(0)&&(e.$pristine&&(e.$pristine=!0),e.$dirty&&(e.$dirty=!1))}))}function t(e){e&&c(e,function(e){e.$unwatch()})}var n=e("ng-hyper/package.js"),i=e("ng-hyper/lib/utils.js"),o=i.$safeApply,a=i.merge,s=i.shallowMerge,c=angular.forEach,u=e("[email protected]");n.directive("hyperForm",["$location","hyper","hyperLink","hyperStatus",function(e,n,i,p){return{scope:!0,require:"form",link:function(h,f,l,d){function g(e){if(b()){h.values={},h.inputs=v(e.input,h);var r=h.set=j(h.inputs);return h.submit=k(e.method,e.action,r),h.reset=w(h.inputs),p.loaded(f)}}function y(){return t(h.inputs),delete h.values,delete h.inputs,delete h.set,delete h.submit,delete h.reset,p.undef(f)}function v(e,r){var t=[],n=r.inputs,i=0,o=m(e);return c(e,function(e,n){var a=e.value;if("hidden"===e.type)return o(n,a);var c=s({$model:a,$orig:a,name:n},e);t[i++]=c,t[n]=c,c.$unwatch=r.$watch(function(){return c.$model},function(){o(n,c.$model)})}),0===i?[]:a(n,t)}function m(){return function(e,r){h.values[e]=r}}function b(){return!d.$dirty}function j(e){return function(r,t){h.values[r]=t,e[r]&&(e[r].$model=t)}}function k(e,r,t){return e=(e||"GET").toUpperCase(),function(i){h.hyperFormLoading||d.$invalid||(angular.forEach(i||{},function(e,r){t(r,e)}),h.hyperFormLoading=!0,f.addClass("ng-hyper-form-loading"),l.hyperAction&&"GET"===e?$(r,h.values,l.hyperAction):n.submit(e,r,h.values,_,!!l.hyperDisableRefresh))}}function w(e){return function(){c(e,function(e){e.$model=""})}}function _(e,t){o.call(h,function(){delete h.hyperFormLoading,h.hyperFormResponse=t,f.removeClass("ng-hyper-form-loading"),C(e,t),e&&(h.hyperFormError=e.error),r(d,f)})}function $(r,t,n){var a=r+"?"+u.stringify(t),s=h.$new();s.query={href:a};var c=i(n,s);s.$destroy(),c.loaded&&o.call(h,function(){e.path(c.href)})}p.loading(f);var C;h.$watch(l.hyperHandle,function(e){C=e||angular.noop}),f.bind("submit",function(){h.submit&&h.submit()}),n.get(l.hyperForm,h,function(e){return e&&e.action?g(e):y(e)})}}}])}),e.register("ng-hyper/directives/hyper-img.js",function(){var r=e("ng-hyper/package.js"),t=e("[email protected]");r.directive("hyperImg",["hyper","hyperStatus",function(e,r){return{scope:!0,restrict:"A",link:function(n,i,o){r.loading(i),e.get(o.hyperImg,n,function(e){var n=r.isLoaded(e),o=n?e.src||e.href||e:"",a=n?e.title||e.alt||"":"";if(angular.isArray(o)){var s=t(o,function(e){return e.src+" "+(e.size||"")}).join(", ");i.prop("srcset",s),o=o[0].src}return i.prop("src",o),i.prop("alt",a),n?r.loaded(i):r.undef(i)})}}}])}),e.register("ng-hyper/directives/hyper-img-background.js",function(){{var r=e("ng-hyper/package.js");e("[email protected]")}r.directive("hyperImgBackground",["hyper","hyperStatus",function(e,r){return{scope:!0,restrict:"A",link:function(t,n,i){r.loading(n),e.get(i.hyperImgBackground,t,function(e){{var t=r.isLoaded(e),i=t?e.src||e.href||e:"";t?e.title||e.alt||"":""}return i?n.css("background-image","url("+i+")"):n.css("background-image",null),t?r.loaded(n):r.undef(n)})}}}])}),e.register("ng-hyper/directives/hyper-input.js",function(){var r=e("ng-hyper/templates/inputs.html"),t=e("ng-hyper/package.js");t.directive("hyperInput",["hyper",function(e){return{template:r,replace:!0,scope:{input:"=hyperInput"},compile:function(r,t){var n=t["class"];return r.removeClass(t["class"]),{pre:function(e){e.inputClass=n},post:function(r){function t(t,n){e.get("input."+t,r,function(e){r[t]=e,n&&n(e)})}t("placeholder"),t("prompt")}}}}}])}),e.register("ng-hyper/directives/hyper-input-options.js",function(){var r=e("ng-hyper/package.js");r.directive("hyperInputOptions",["hyper",function(e){return{link:function(r,t,n){function i(){angular.forEach(r.options||[],function(t){function n(n){e.get(n,t,function(e){t[n]=e;try{r.$digest()}catch(i){}})}t&&n("text")})}e.get(n.hyperInputOptions,r,function(e){r.options=e||[],i()}),r.$watch("options[0].text",function(e){"object"==typeof e&&e.href&&i()})}}}])}),e.register("ng-hyper/directives/hyper-link.js",function(){var r=e("ng-hyper/package.js");r.directive("hyperLink",["$location","hyperLink","hyperStatus",function(e,r,t){return{link:function(n,i,o){function a(){if(p)return c();var r=e.url()||"/";return u===r||"/"+u===r?s():void 0}function s(){i.addClass("active"),p=!0}function c(){i.removeClass("active"),p=!1}t.loading(i);var u=o.hyperLink,p=!1;n.$on("$locationChangeSuccess",a),r.watch(u,n,function(e){u=e,i.attr("href",e),t.loaded(i),a()})}}}])}),e.register("ng-hyper/directives/hyper-redirect.js",function(){var r=e("ng-hyper/package.js");r.directive("hyperRedirect",["$location","hyperLink","hyperStatus",function(e,r,t){return{link:function(n,i,o){t.loading(i),r.watch(o.hyperRedirect,n,function(r){"false"!==o.replace&&e.replace(),e.path(r)})}}}])}),e.register("ng-hyper/directives/hyper.js",function(){function r(e){for(var r=0,t=e.length;t>r;r++){var n=e[r];if(!n)return null;if(n.value||r===t-1)return n}}var t=e("ng-hyper/package.js"),n=e("ng-hyper/lib/utils.js").merge;t.directive("hyper",["hyper","hyperStatus",function(e,t){return{scope:!0,restrict:"A",link:function(i,o,a){function s(){for(var e=0,r=u.length;r>e;e++)if(!t.isLoaded(u[e]))return t.undef(o);t.loaded(o)}t.loading(o);var c=a.hyper.trim().split(/ *, */),u=[];angular.forEach(c,function(t,o){function a(){var e=r(f),t=e?e.target:h,a=u[o]=e?e.value:void 0;i[t]=n(i[t],a),s()}var c=t.split(/ +as +/),p=c[0].split(/ +or +/),h=c[1],f=[];angular.forEach(p,function(r,t){e.get(r,i,function(e,r){f[t]={target:h||r.target,value:e},a()})})})}}}])}),e.register("ng-hyper/services/hyper.js",function(){var r=e("ng-hyper/package.js"),t=e("ng-hyper/lib/utils.js").$safeApply;r.factory("hyper",["$exceptionHandler","hyperBackend","hyperPath",function(e,r,n){function i(i,o,a){"function"==typeof o&&(a=o,o=null);var s=n(i,r);return!s.isRoot&&o&&o.$watch&&o.$watch(s.index,function(e){s._root=s.root||{},s._root[s.index]=e,s.scope(s._root)},!0),o&&!o.$watch&&s.scope(o),s.on(function(r,n){return r?e(r):o&&o.$apply?t.call(o,function(){a(n,s)}):void a(n,s)}),o&&o.$on?o.$on("$destroy",function(){s.off()}):s.off(),s}function o(e,t,n,i,o){r.submit(e,t,n,i,o)}return{get:i,submit:o}}])}),e.register("ng-hyper/services/hyper-path.js",function(){var r=e("ng-hyper/package.js"),t=e("[email protected]");r.factory("hyperPath",[function(){return t}])}),e.register("ng-hyper/services/hyper-link.js",function(){var r=e("ng-hyper/package.js"),t=angular.forEach,n=e("[email protected]");r.value("hyperLinkRegexp",/:([\w-\.]+)/g),r.factory("hyperLink",["hyper","hyperLinkFormatter","hyperLinkRegexp",function(e,r,i){function o(e,t){var n={loaded:!0};return n.href=e.replace(i,function(e,i){return t[i]||0===t[i]?r.encode(t[i]):(n.loaded=!1,"-")}),"/"===n.href.charAt(0)&&(n.href=n.href.substring(1)),n}return o.watch=function(r,n,i){function a(e){var t=o(r,e);t.loaded&&i(t.href)}var s=o.parse(r);if(!s)return i(r);var c={};t(s,function(r){e.get(r,n,function(e){c[r]=e,a(c)})})},o.parse=function(e){var r=e.match(i);if(r)return n(r,function(e){return e.substr(1)})},o}])}),e.register("ng-hyper/services/hyper-link-formatter.js",function(){var r=e("ng-hyper/package.js"),t=e("camshaft~websafe-base64@master"),n=e("[email protected]");r.factory("hyperLinkFormatter",["hyperHttpRoot",function(e){function r(r){return r&&r.href?t.encode(r.href.replace(e,"~")):angular.isString(r)?n(r):angular.isNumber(r)?""+r:"-"}function i(r){try{return t.decode(r).replace("~",e)}catch(n){}}return{encode:r,decode:i}}])}),e.register("ng-hyper/services/hyper-status.js",function(){var r=e("ng-hyper/package.js");r.factory("hyperStatus",[function(){return{loading:function(e){e.removeClass("ng-hyper-loaded"),e.addClass("ng-hyper-loading")},loaded:function(e){e.removeClass("ng-hyper-loading"),e.removeClass("ng-hyper-loaded-undefined"),e.addClass("ng-hyper-loaded"),e.addClass("ng-hyper-loaded-defined")},undef:function(e){e.removeClass("ng-hyper-loading"),e.removeClass("ng-hyper-loaded-defined"),e.addClass("ng-hyper-loaded"),e.addClass("ng-hyper-loaded-undefined")},isLoaded:function(e){return"undefined"!=typeof e}}}])}),e.register("ng-hyper/services/hyper-backend-http.js",function(){var r=e("ng-hyper/package.js"),t=e("[email protected]"),n=e("[email protected]"),i=window.location,o=i.protocol+"//"+i.host;r.value("hyperHttpRoot",o+"/api"),r.value("hyperHttpRefreshHeaders",["location","content-location"]);var a=!!~window.navigator.userAgent.indexOf("Firefox");r.factory("hyperBackend",["$http","hyperHttpRoot","hyperHttpEmitter","hyperHttpRefreshHeaders","$cacheFactory",function(e,r,t,i,o){function s(e){return c(r,e)}function c(r,i){function o(a){return function(s){return s?i(null,angular.copy(s)):void e.get(r,{cache:p}).success(function(e,s,c){var u={};try{u=n(c("link"))}catch(p){}a&&"string"==typeof e.href&&r!==e.href&&t(e.href,o()),i(null,e,u)}).error(function(e,r){return 404===r?i():void i(e)})}}return r=r.replace(/#.*/,""),t(r,o(!0))}function u(r,o,s,c,u){r=r.toUpperCase();var p={method:r,url:o};"GET"===r?p.params=s:p.data=s,e(p).success(function(e,s,p){var h={};try{h=n(p("link"))}catch(f){}if(c(null,e,h),"GET"!==r){u||t.refresh(o,!a),angular.forEach(i,function(e){var r=p(e);r&&t.refresh(r,!a)});var l=h.invalidates;l="string"==typeof l?[l]:l,angular.forEach(l||[],function(e){t.refresh(e,!a)})}}).error(function(e){c(e)})}var p=o("hyperHttpCache");return{root:s,get:c,submit:u}}]),r.factory("hyperHttpEmitter",["$http","$cacheFactory",function(e,r){function n(e,r){function t(e,t,n){r(e,t,n)}return 0===e.indexOf("/")&&(e=o+e),a.on(e,t),r(),1===a.listeners(e).length&&s.emit("subscribe",e),function(){a.off(e,t),a.hasListeners(e)||s.emit("unsubscribe",e)}}var i,a=new t,s=new t;return n.refresh=function(t,o){i||(i=r.get("hyperHttpCache")),i.remove(t);var s={headers:{"cache-control":"no-cache, must-revalidate",pragma:"no-cache"},cache:i};e.get(t,s).success(function(e){o?a.emit(t,e):n.refresh(t,!0)}).error(function(e){console.error(e.stack||e)})},n.subscribe=function(e){s.on("subscribe",e)},n.unsubscribe=function(e){s.on("unsubscribe",e)},n}])}),e.register("ng-hyper/lib/utils.js",function(r){function t(e){var r=this.$root;if(!r)return this.$apply(e);var t=r.$$phase;return"$apply"===t||"$digest"===t?e():void this.$apply(e)}function n(e,r){var t=o(r);if("object"!==t&&"array"!==t)return r;if(o(e)!==t)return r;if("array"===t&&e.splice(r.length),"object"===t)for(var i in e)i.charAt&&"$"===i.charAt(0)||r[i]||delete e[i];for(var i in r)e[i]=n(e[i],r[i]);return e}function i(e,r){for(var t in r)e[t]=r[t];return e}var o=e("[email protected]");r.$safeApply=t,r.merge=n,r.shallowMerge=i}),e.define("ng-hyper/templates/inputs.html",'<div data-ng-class="{\'ng-hyper-loading\': !input, \'ng-hyper-loaded\': input}" data-ng-switch="input.type">\n <select data-ng-switch-when="select" name="{{input.name}}" data-ng-model="input.$model" data-ng-required="input.required" data-ng-disabled="input.disabled" data-hyper-input-options="input.options" data-ng-options="option.value as (option.name || option.text || option.value) for option in options" class="{{inputClass}}"></select>\n <textarea data-ng-switch-when="textarea" name="{{input.name}}" data-ng-model="input.$model" placeholder="{{placeholder || input.prompt || input.title || input.name}}" data-ng-required="input.required" data-ng-disabled="input.disabled" class="{{inputClass}}"></textarea>\n <input data-ng-switch-default name="{{input.name}}" data-ng-model="input.$model" type="{{input.type}}" placeholder="{{placeholder || input.prompt || input.title || input.name}}" data-ng-required="input.required" data-ng-disabled="input.disabled" class="{{inputClass}}" />\n</div>\n'),"object"==typeof exports?module.exports=e("ng-hyper"):"function"==typeof define&&define.amd?define([],function(){return e("ng-hyper")}):this["ng-hyper"]=e("ng-hyper")}();