26 lines
33 KiB
JavaScript
26 lines
33 KiB
JavaScript
|
define(["exports","./when-b60132fc","./Check-7b2a090c","./RuntimeError-4a5c8994"],(function(e,t,r,n){"use strict";
|
||
|
/**
|
||
|
* @license
|
||
|
*
|
||
|
* Grauw URI utilities
|
||
|
*
|
||
|
* See: http://hg.grauw.nl/grauw-lib/file/tip/src/uri.js
|
||
|
*
|
||
|
* @author Laurens Holst (http://www.grauw.nl/)
|
||
|
*
|
||
|
* Copyright 2012 Laurens Holst
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*
|
||
|
*/function i(e){if(e instanceof i)this.scheme=e.scheme,this.authority=e.authority,this.path=e.path,this.query=e.query,this.fragment=e.fragment;else if(e){var t=o.exec(e);this.scheme=t[1],this.authority=t[2],this.path=t[3],this.query=t[4],this.fragment=t[5]}}i.prototype.scheme=null,i.prototype.authority=null,i.prototype.path="",i.prototype.query=null,i.prototype.fragment=null;var o=new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?$");i.prototype.getScheme=function(){return this.scheme},i.prototype.getAuthority=function(){return this.authority},i.prototype.getPath=function(){return this.path},i.prototype.getQuery=function(){return this.query},i.prototype.getFragment=function(){return this.fragment},i.prototype.isAbsolute=function(){return!!this.scheme&&!this.fragment},i.prototype.isSameDocumentAs=function(e){return e.scheme==this.scheme&&e.authority==this.authority&&e.path==this.path&&e.query==this.query},i.prototype.equals=function(e){return this.isSameDocumentAs(e)&&e.fragment==this.fragment},i.prototype.normalize=function(){this.removeDotSegments(),this.scheme&&(this.scheme=this.scheme.toLowerCase()),this.authority&&(this.authority=this.authority.replace(a,c).replace(s,f)),this.path&&(this.path=this.path.replace(s,f)),this.query&&(this.query=this.query.replace(s,f)),this.fragment&&(this.fragment=this.fragment.replace(s,f))};var s=/%[0-9a-z]{2}/gi,u=/[a-zA-Z0-9\-\._~]/,a=/(.*@)?([^@:]*)(:.*)?/;function f(e){var t=unescape(e);return u.test(t)?t:e.toUpperCase()}function c(e,t,r,n){return(t||"")+r.toLowerCase()+(n||"")}function p(e,r){if(null===e||"object"!=typeof e)return e;r=t.defaultValue(r,!1);var n=new e.constructor;for(var i in e)if(e.hasOwnProperty(i)){var o=e[i];r&&(o=p(o,r)),n[i]=o}return n}function l(e,r,n){n=t.defaultValue(n,!1);var i,o,s,u={},a=t.defined(e),f=t.defined(r);if(a)for(i in e)e.hasOwnProperty(i)&&(o=e[i],f&&n&&"object"==typeof o&&r.hasOwnProperty(i)?(s=r[i],u[i]="object"==typeof s?l(o,s,n):o):u[i]=o);if(f)for(i in r)r.hasOwnProperty(i)&&!u.hasOwnProperty(i)&&(s=r[i],u[i]=s);return u}function h(e,t){var r;return"undefined"!=typeof document&&(r=document),h._implementation(e,t,r)}i.prototype.resolve=function(e){var t=new i;return this.scheme?(t.scheme=this.scheme,t.authority=this.authority,t.path=this.path,t.query=this.query):(t.scheme=e.scheme,this.authority?(t.authority=this.authority,t.path=this.path,t.query=this.query):(t.authority=e.authority,""==this.path?(t.path=e.path,t.query=this.query||e.query):("/"==this.path.charAt(0)?(t.path=this.path,t.removeDotSegments()):(e.authority&&""==e.path?t.path="/"+this.path:t.path=e.path.substring(0,e.path.lastIndexOf("/")+1)+this.path,t.removeDotSegments()),t.query=this.query))),t.fragment=this.fragment,t},i.prototype.removeDotSegments=function(){var e,t=this.path.split("/"),r=[],n=""==t[0];for(n&&t.shift(),""==t[0]&&t.shift();t.length;)".."==(e=t.shift())?r.pop():"."!=e&&r.push(e);"."!=e&&".."!=e||r.push(""),n&&r.unshift(""),this.path=r.join("/")},i.prototype.toString=function(){var e="";return this.scheme&&(e+=this.scheme+":"),this.authority&&(e+="//"+this.authority),e+=this.path,this.query&&(e+="?"+this.query),this.fragment&&(e+="#"+this.fragment),e},h._implementation=function(e,r,n){if(!t.defined(r)){if(void 0===n)return e;r=t.defaultValue(n.baseURI,n.location.href)}var o=new i(r);return new i(e).resolve(o).toString()};var d,m=/^blob:/i;function y(e){return m.test(e)}var v=/^data:/i;function g(e){return v.test(e)}var q=Object.freeze({UNISSUED:0,ISSUED:1,ACTIVE:2,RECEIVED:3,CANCELLED:4,FAILED:5}),b=Object.freeze({TERRAIN:0,IMAGERY:1,TILES3D:2,OTHER:3,PACK:4,BLOCK:5,BLOCKPACK:6});function R(e){e=t.defaultValue(e,t.defaultValue.EMPTY_OBJECT);var r=t.defaultValue(e.throttleByServer,!1),n=t.defaultValue(e.throttle,!1);this.url=e.url,this.requestFunction=e.requestFunction,this.cancelFunction=e.cancelFunction,this.priorityFunction=e.priorityFunction,this.priority=t.defaultValue(e.priority,0),this.throttle=n,this.throttleByServer=r,this.type=t.defaultValue(e.type,b.OTHER),this.serverKey=void 0,this.state=q.UNISSUED,this.deferred=void
|