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