/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import{__decorate as t}from"tslib";import e from"../Viewpoint.js";import{IdentifiableMixin as o}from"../core/Identifiable.js";import{JSONSupport as r}from"../core/JSONSupport.js";import{clone as i}from"../core/lang.js";import n from"../core/Logger.js";import{property as p,cast as s,subclass as m}from"../core/accessorSupport/decorators.js";import{ensureType as l}from"../core/accessorSupport/ensureType.js";import a from"../webdoc/support/SlideThumbnail.js";import{timeExtent as u}from"../webdoc/support/timeProperties.js";import{addPropertyUnsupportedError as c}from"../webdoc/support/unsupportedErrors.js";import{reader as w}from"../core/accessorSupport/decorators/reader.js";import{writer as d}from"../core/accessorSupport/decorators/writer.js";var h;let y=h=class extends(o(r)){constructor(t){super(t),this.name=null,this.thumbnail=new a,this.timeExtent=null}castThumbnail(t){return"string"==typeof t?new a({url:t}):l(a,t)}set viewpoint(t){const{targetGeometry:e,scale:o}=t;null!=e&&"point"===e.type&&null==o&&n.getLogger(this).warn("Bookmark.viewpoint should include 'scale' when its targetGeometry is a point.",t),this._set("viewpoint",t)}readViewpoint(t,o){const{extent:r,viewpoint:i}=o;return e.fromJSON(i||{targetGeometry:r})}writeViewpoint(t,e,o,r){if(!t)return;const{targetGeometry:i}=t;if(null!=i&&"extent"!==i.type){const t="cannot be written to JSON when the viewpoint's targetGeometry is not an extent.";return void(r?.messages?c(r,"Bookmark.viewpoint",t):n.getLogger(this).error(t))}null!=i&&(e.extent=i.toJSON()),e[o]=t.toJSON()}clone(){return new h(i({name:this.name,thumbnail:this.thumbnail,timeExtent:this.timeExtent,viewpoint:this.viewpoint}))}};t([p({type:String,nonNullable:!0,json:{write:{isRequired:!0}}})],y.prototype,"name",void 0),t([p({type:a,json:{write:{overridePolicy:t=>({enabled:!(!t||!t.url)})}}})],y.prototype,"thumbnail",void 0),t([s("thumbnail")],y.prototype,"castThumbnail",null),t([p(u)],y.prototype,"timeExtent",void 0),t([p({type:e,nonNullable:!0,json:{write:!0}})],y.prototype,"viewpoint",null),t([w("viewpoint",["extent","viewpoint"])],y.prototype,"readViewpoint",null),t([d("viewpoint")],y.prototype,"writeViewpoint",null),y=h=t([m("esri.webmap.Bookmark")],y);const f=y;export{f as default};
